Updated skip logic if plant not found

This commit is contained in:
dhanabalan
2025-04-28 00:14:18 +05:30
parent 38c37c74ed
commit c8e2a9c7b9
2 changed files with 6 additions and 0 deletions

View File

@@ -46,6 +46,9 @@ class ItemImporter extends Importer
public function resolveRecord(): ?Item public function resolveRecord(): ?Item
{ {
$plant = \App\Models\Plant::where('name', $this->data['plant'])->first(); $plant = \App\Models\Plant::where('name', $this->data['plant'])->first();
if (!$plant) {
return null;
}
return Item::updateOrCreate([ return Item::updateOrCreate([
'code' => $this->data['code'], 'code' => $this->data['code'],
'plant_id' => $plant->id 'plant_id' => $plant->id

View File

@@ -39,6 +39,9 @@ class LineImporter extends Importer
public function resolveRecord(): ?Line public function resolveRecord(): ?Line
{ {
$plant = \App\Models\Plant::where('name', $this->data['plant'])->first(); $plant = \App\Models\Plant::where('name', $this->data['plant'])->first();
if (!$plant) {
return null;
}
return Line::updateOrCreate([ return Line::updateOrCreate([
'name' => $this->data['name'], 'name' => $this->data['name'],
'plant_id' => $plant->id 'plant_id' => $plant->id