|
|
|
@ -2,6 +2,8 @@ |
|
|
|
|
|
|
|
namespace App\Imports; |
|
|
|
|
|
|
|
use App\Models\ParkingPattern; |
|
|
|
use App\Services\AdminTranslationService; |
|
|
|
use App\Services\OperationLogService; |
|
|
|
use App\Services\ParkingPatternService; |
|
|
|
use Maatwebsite\Excel\Concerns\ToModel; |
|
|
|
@ -48,6 +50,21 @@ class ParkingPatternImport implements ToModel |
|
|
|
$this->error[] = imports_error($this->index, 'import16'); |
|
|
|
return; |
|
|
|
} |
|
|
|
$exists = ParkingPattern::query()->where('name', $this->model_name) |
|
|
|
->exists(); |
|
|
|
if ($exists) { |
|
|
|
$this->error[] = imports_error($this->index, 'import39'); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
$pattern_id = AdminTranslationService::getTypeId( |
|
|
|
10, |
|
|
|
$this->model_name |
|
|
|
); |
|
|
|
if ($pattern_id) { |
|
|
|
$this->error[] = imports_error($this->index, 'import39'); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
$data = [ |
|
|
|
'model_name' => $this->model_name, |
|
|
|
'admin_user_id' => $this->user_id, |
|
|
|
|