33 lines
634 B
PHP
Raw Normal View History

2019-11-16 10:21:14 +03:00
<?php
2019-12-31 15:49:09 +03:00
namespace App\Imports\Purchases;
2019-11-16 10:21:14 +03:00
2020-01-20 01:26:35 +03:00
use App\Abstracts\Import;
2019-11-16 10:21:14 +03:00
use App\Http\Requests\Common\Contact as Request;
use App\Models\Common\Contact as Model;
2019-11-16 10:21:14 +03:00
2020-01-20 01:26:35 +03:00
class Vendors extends Import
2019-11-16 10:21:14 +03:00
{
public function model(array $row)
{
return new Model($row);
2019-11-16 10:21:14 +03:00
}
public function map($row): array
{
2020-01-20 11:12:14 +03:00
$row = parent::map($row);
2019-11-16 10:21:14 +03:00
2021-11-08 02:40:40 +03:00
$country = array_search($row['country'], trans('countries'));
2020-01-20 11:12:14 +03:00
$row['type'] = 'vendor';
2021-11-08 02:40:40 +03:00
$row['country'] = !empty($country) ? $country : null;
2019-11-16 10:21:14 +03:00
return $row;
}
public function rules(): array
{
return (new Request())->rules();
}
2020-01-20 01:26:35 +03:00
}