|
|
|
@ -7,15 +7,15 @@ use App\Services\OperationLogService; |
|
|
|
use App\Services\ParkingLicensePlateService; |
|
|
|
use Illuminate\Support\Facades\Auth; |
|
|
|
use Maatwebsite\Excel\Concerns\ToModel; |
|
|
|
use Maatwebsite\Excel\Concerns\WithHeadingRow; |
|
|
|
|
|
|
|
class ParkingVipListImport implements ToModel, WithHeadingRow |
|
|
|
class ParkingVipListImport implements ToModel |
|
|
|
{ |
|
|
|
|
|
|
|
/** |
|
|
|
* @var OperationLogService |
|
|
|
*/ |
|
|
|
private OperationLogService $logService; |
|
|
|
protected int $index = 1; |
|
|
|
|
|
|
|
public function __construct() |
|
|
|
{ |
|
|
|
@ -28,8 +28,12 @@ class ParkingVipListImport implements ToModel, WithHeadingRow |
|
|
|
*/ |
|
|
|
public function model(array $row) |
|
|
|
{ |
|
|
|
if (isset($row['license_plate_no']) && $row['license_plate_no']) { |
|
|
|
$license = $row['license_plate_no']; |
|
|
|
if ($this->index == 1) { |
|
|
|
$this->index += 1; |
|
|
|
return; |
|
|
|
} |
|
|
|
if (isset($row[1]) && $row[1]) { |
|
|
|
$license = $row[1]; |
|
|
|
$license_id = (new ParkingLicensePlateService($this->logService))->createLicenseId($license); |
|
|
|
if (!ParkingVipList::query()->where('license_id', $license_id) |
|
|
|
->exists() |
|
|
|
|