Added update or create record on import
This commit is contained in:
@@ -38,12 +38,21 @@ class LineImporter extends Importer
|
||||
|
||||
public function resolveRecord(): ?Line
|
||||
{
|
||||
$plant = \App\Models\Plant::where('name', $this->data['plant'])->first();
|
||||
return Line::updateOrCreate([
|
||||
'name' => $this->data['name'],
|
||||
'plant_id' => $plant->id
|
||||
],
|
||||
[
|
||||
'type' => $this->data['type']
|
||||
]
|
||||
);
|
||||
// return Line::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new Line();
|
||||
// return new Line();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
|
||||
Reference in New Issue
Block a user