mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge pull request #1068 from openclassify/muammertop
advs import fixed
This commit is contained in:
commit
4777ed6562
@ -4,16 +4,21 @@ namespace Visiosoft\AdvsModule\Adv;
|
|||||||
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Maatwebsite\Excel\Concerns\ToModel;
|
use Maatwebsite\Excel\Concerns\ToModel;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||||
|
|
||||||
class AdvsImport implements ToModel
|
|
||||||
|
class AdvsImport implements ToModel, WithHeadingRow
|
||||||
{
|
{
|
||||||
public function model(array $row)
|
public function model(array $row)
|
||||||
{
|
{
|
||||||
return new AdvModel([
|
if ($row['name'] !== null && $row['price'] !== null && $row['currency'] !== null) {
|
||||||
'name' => $row[0],
|
return new AdvModel([
|
||||||
'slug' => Str::slug($row[0]),
|
'name' => $row['name'],
|
||||||
'price' => $row[1],
|
'slug' => Str::slug($row['name']),
|
||||||
'currency' => $row[2],
|
'advs_desc' => $row['description'],
|
||||||
]);
|
'price' => $row['price'],
|
||||||
|
'currency' => $row['currency'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user