From 468a8bfe2c083aa76a511080e811d542ec007c1b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 1 Mar 2023 23:02:48 +1100 Subject: [PATCH] Improvements for reports --- app/Export/CSV/BaseExport.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Export/CSV/BaseExport.php b/app/Export/CSV/BaseExport.php index d8754cb598d2..2b003bf75cdf 100644 --- a/app/Export/CSV/BaseExport.php +++ b/app/Export/CSV/BaseExport.php @@ -11,8 +11,9 @@ namespace App\Export\CSV; -use App\Utils\Traits\MakesHash; +use App\Models\Client; use Illuminate\Support\Carbon; +use App\Utils\Traits\MakesHash; class BaseExport { @@ -28,10 +29,15 @@ class BaseExport public string $end_date = ''; + public string $client_description = 'All Clients'; + protected function filterByClients($query) { if (array_key_exists('client_id', $this->input) && $this->input['client_id'] != 'all') { - return $query->where('client_id', $this->decodePrimaryKey($this->input['client_id'])); + + $client = Client::withTrashed()->find($this->input['client_id']); + $this->client_description = $client->present()->name; + return $query->where('client_id', $this->input['client_id']); } return $query;