Merge pull request #1081 from openclassify/muammertop

edited advs import
This commit is contained in:
Dia Shalabi 2021-05-19 12:22:07 +03:00 committed by GitHub
commit acd552b781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,13 +12,18 @@ class AdvsImport implements ToModel, WithHeadingRow
public function model(array $row) public function model(array $row)
{ {
if ($row['name'] !== null && $row['price'] !== null && $row['currency'] !== null) { if ($row['name'] !== null && $row['price'] !== null && $row['currency'] !== null) {
return new AdvModel([ return new AdvModel([
'name' => $row['name'], 'name' => $row['name'],
'slug' => Str::slug($row['name']), 'slug' => Str::slug($row['name']),
'advs_desc' => $row['description'], 'advs_desc' => $row['description'] ?? null,
'price' => $row['price'], 'standard_price' => $row['standard_price'] ?? null,
'currency' => $row['currency'], 'price' => $row['price'],
]); 'currency' => $row['currency'],
'country' => $row['country'] ?? null,
'city' => $row['city'] ?? null,
'cat1' => $row['cat1'] ?? null,
'cat2' => $row['cat2'] ?? null,
]);
} }
} }
} }