diff --git a/app/Filament/Imports/PlantImporter.php b/app/Filament/Imports/PlantImporter.php index df83486..fae6c67 100644 --- a/app/Filament/Imports/PlantImporter.php +++ b/app/Filament/Imports/PlantImporter.php @@ -79,12 +79,12 @@ class PlantImporter extends Importer } elseif (Str::length($name) < 5) { $warnMsg[] = 'Name should contain at least 5 characters!'; } - if ($wareHouseNo == null || $wareHouseNo == '' || ! $wareHouseNo) { - // $warnMsg[] = "Warehouse number can't be empty!"; - } elseif (! is_numeric($wareHouseNo)) { - $warnMsg[] = 'Warehouse number should contain only numeric values!'; - } elseif (Str::length($wareHouseNo) == 3) { - $warnMsg[] = 'Warehouse number must contain 3 digits only!'; + if ($wareHouseNo != null && $wareHouseNo != '' && $wareHouseNo) { + if (! is_numeric($wareHouseNo)) { + $warnMsg[] = 'Warehouse number should contain only numeric values!'; + } elseif (Str::length($wareHouseNo) != 3) { + $warnMsg[] = 'Warehouse number must contain 3 digits only!'; + } } if ($addr == null || $addr == '' || ! $addr) { $warnMsg[] = "Address can't be empty!"; @@ -127,12 +127,12 @@ class PlantImporter extends Importer return Plant::updateOrCreate([ 'code' => $code, - 'name' => $name, ], [ 'warehouse_number' => $wareHouseNo, 'address' => $addr, 'company_id' => $compId, + 'name' => $name, ] ); // return Plant::firstOrNew([