diff --git a/app/Filament/Resources/CharacteristicApproverMasterResource.php b/app/Filament/Resources/CharacteristicApproverMasterResource.php index a4244de..36e7f11 100644 --- a/app/Filament/Resources/CharacteristicApproverMasterResource.php +++ b/app/Filament/Resources/CharacteristicApproverMasterResource.php @@ -411,7 +411,7 @@ class CharacteristicApproverMasterResource extends Resource if ($userHas && strlen($userHas) > 0) { return Plant::where('id', $userHas)->pluck('name', 'id')->toArray(); } else { - return Plant::whereHas('requestCharacteristics', function ($query) { + return Plant::whereHas('characteristicApproverMaster', function ($query) { $query->whereNotNull('id'); })->orderBy('code')->pluck('name', 'id'); } @@ -434,7 +434,7 @@ class CharacteristicApproverMasterResource extends Resource return []; } - return Machine::whereHas('requestCharacteristics', function ($query) use ($plantId) { + return Machine::whereHas('characteristicApproverMaster', function ($query) use ($plantId) { if ($plantId) { $query->where('plant_id', $plantId); } diff --git a/app/Models/Machine.php b/app/Models/Machine.php index dd21db5..bcd2209 100644 --- a/app/Models/Machine.php +++ b/app/Models/Machine.php @@ -53,6 +53,11 @@ class Machine extends Model return $this->hasMany(RequestCharacteristic::class, 'machine_id', 'id'); } + public function characteristicApproverMaster() + { + return $this->hasMany(CharacteristicApproverMaster::class, 'machine_id', 'id'); + } + public function productionCharacteristics() { return $this->hasMany(ProductionCharacteristic::class, 'machine_id', 'id'); diff --git a/app/Models/Plant.php b/app/Models/Plant.php index 113dab2..5a5e9aa 100644 --- a/app/Models/Plant.php +++ b/app/Models/Plant.php @@ -193,4 +193,9 @@ class Plant extends Model // { // return $this->hasMany(LocatorValidation::class, 'plant_id', 'id'); // } + + public function characteristicApproverMaster() + { + return $this->hasMany(CharacteristicApproverMaster::class, 'plant_id', 'id'); + } }