From a05006a5a8b8d0a4398a307b37250129bbe15658 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Tue, 15 Feb 2022 10:44:48 +0100 Subject: [PATCH] Fix GET /invoices --- app/Http/Controllers/InvoiceController.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 5982398..4834d4d 100755 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -241,27 +241,17 @@ class InvoiceController extends Controller 'network_id' => 'required_without:network_agent_id|integer|exists:networks,id', 'network_agent_id' => 'required_without:network_id|integer|exists:networks_agents,id' ]); - $network_id = $request->input('network_id'); $network_agent_id = $request->input('network_agent_id'); - // Correction temporaire - $insured_id = $request->input('insured_id'); - if (!empty($insured_id)) { - $network_agent_id = $insured_id; - } $query = NhInfosInvoice::with(['health_care_sheets:id,invoice_id,health_care_sheet_id,type,practitioner_lastname,practitioner_firstname,practitioner_provider_class,patient_lastname,patient_firstname,institution_name,institution_code']); -// if (!empty($network_id)) { -// $query = $query->where('network_id', $network_id); -// } + if (!empty($network_id)) { + $query = $query->where('network_id', $network_id); + } if (!empty($network_agent_id)) { $query = $query->where('network_agent_id', $network_agent_id); - } else { - if (!empty($network_id)) { - $query = $query->where('network_id', $network_id); - } } $invoices = $query->orderBy('created_at', 'DESC')->paginate($request->input('perPage', 10));