Updated skip logic if plant not found
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user