From 041cc11030ea4fdf6968bdccf17eacab5de392a0 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 14 Jan 2026 09:14:45 +0530 Subject: [PATCH] Added view rights against plant on view report --- app/Filament/Resources/InvoiceValidationResource.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/Filament/Resources/InvoiceValidationResource.php b/app/Filament/Resources/InvoiceValidationResource.php index ce941cc..0a62e86 100644 --- a/app/Filament/Resources/InvoiceValidationResource.php +++ b/app/Filament/Resources/InvoiceValidationResource.php @@ -1181,6 +1181,12 @@ class InvoiceValidationResource extends Resource if (! empty($data['Plant'])) { // $plant = $data['Plant'] ?? null $query->where('plant_id', $data['Plant']); + } else { + $userHas = Filament::auth()->user()->plant_id; + + if ($userHas && strlen($userHas) > 0) { + return $query->whereRaw('1 = 0'); + } } if (! empty($data['invoice_number'])) { @@ -1218,6 +1224,12 @@ class InvoiceValidationResource extends Resource if (! empty($data['Plant'])) { $indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name'); + } else { + $userHas = Filament::auth()->user()->plant_id; + + if ($userHas && strlen($userHas) > 0) { + return 'Plant: Choose plant to filter records.'; + } } if (! empty($data['invoice_number'])) {