27 changed files with 884 additions and 16 deletions
@ -0,0 +1,54 @@ |
|||
<?php |
|||
|
|||
namespace App\Exports; |
|||
|
|||
use App\Models\AdminUsers; |
|||
use App\Models\ParkingWhitelist; |
|||
use App\Services\ParkingWhitelistService; |
|||
use Maatwebsite\Excel\Concerns\FromArray; |
|||
use Maatwebsite\Excel\Concerns\WithHeadings; |
|||
|
|||
class ParkingWhitelistExport implements FromArray, WithHeadings |
|||
{ |
|||
/** |
|||
* @return array |
|||
*/ |
|||
public function array(): array |
|||
{ |
|||
$data = []; |
|||
$list = ParkingWhitelist::all()->toArray(); |
|||
$index = 1; |
|||
foreach ($list as $item) { |
|||
$item = ParkingWhitelistService::getItemData($item); |
|||
$data[] = [ |
|||
$index, |
|||
$item['license_plate'], |
|||
$item['parking'], |
|||
$item['channel_str'], |
|||
$item['reason'], |
|||
$item['member_type_str'], |
|||
$item['admin_username'], |
|||
$item['created_at'] |
|||
]; |
|||
$index += 1; |
|||
} |
|||
return $data; |
|||
} |
|||
|
|||
/** |
|||
* @return array |
|||
*/ |
|||
public function headings(): array |
|||
{ |
|||
return [ |
|||
__exports('global.index'), |
|||
__exports('parking_space.license_plate'), |
|||
__exports('whitelist.parking'), |
|||
__exports('whitelist.channel'), |
|||
__exports('whitelist.reason'), |
|||
__exports('whitelist.member_type'), |
|||
__exports('operation_log.operation_name'), |
|||
__exports('operation_log.created_at') |
|||
]; |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
<?php |
|||
|
|||
namespace App\Exports; |
|||
|
|||
use Maatwebsite\Excel\Concerns\FromArray; |
|||
|
|||
class ParkingWhitelistTemplateExport implements FromArray |
|||
{ |
|||
public function array(): array |
|||
{ |
|||
return [ |
|||
[ |
|||
__exports('global.index'), |
|||
__exports('parking_space.license_plate'), |
|||
__exports('whitelist.parking'), |
|||
__exports('whitelist.channel'), |
|||
__exports('whitelist.reason'), |
|||
__exports('whitelist.member_type') |
|||
], |
|||
[ |
|||
'1', |
|||
'测A00001', |
|||
'MSCP', |
|||
'MSCP-入口', |
|||
__exports('whitelist.reason'), |
|||
'懂事' |
|||
], |
|||
[ |
|||
'2', |
|||
'测A00002', |
|||
'MSCP', |
|||
'MSCP-入口', |
|||
__exports('whitelist.reason'), |
|||
'懂事' |
|||
], |
|||
[ |
|||
'3', |
|||
'测A00003', |
|||
'MSCP', |
|||
'MSCP-入口', |
|||
__exports('whitelist.reason'), |
|||
'懂事' |
|||
] |
|||
]; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,332 @@ |
|||
<?php |
|||
|
|||
namespace App\Http\Controllers\Admin; |
|||
|
|||
use App\Exceptions\CustomException; |
|||
use App\Exports\ParkingWhitelistExport; |
|||
use App\Exports\ParkingWhitelistTemplateExport; |
|||
use App\Imports\ParkingWhitelistImport; |
|||
use App\Models\Parking; |
|||
use App\Models\ParkingChannel; |
|||
use App\Models\ParkingLicensePlate; |
|||
use App\Models\ParkingSpaceType; |
|||
use App\Models\ParkingWhitelist; |
|||
use App\Services\ApiResponseService; |
|||
use App\Services\ParkingWhitelistService; |
|||
use Exception; |
|||
use Illuminate\Http\JsonResponse; |
|||
use Illuminate\Http\Request; |
|||
use Illuminate\Support\Facades\Storage; |
|||
use Illuminate\Support\Facades\Validator; |
|||
use Illuminate\Validation\ValidationException; |
|||
use Maatwebsite\Excel\Facades\Excel; |
|||
|
|||
class ParkingWhitelistController extends BaseController |
|||
{ |
|||
|
|||
protected string $menuUri = 'whitelist'; |
|||
|
|||
/** |
|||
* @var ParkingWhitelistService |
|||
*/ |
|||
protected ParkingWhitelistService $service; |
|||
|
|||
/** |
|||
* 构造函数 |
|||
* @param ApiResponseService $responseService |
|||
* @param ParkingWhitelistService $service |
|||
*/ |
|||
public function __construct( |
|||
ApiResponseService $responseService, |
|||
ParkingWhitelistService $service |
|||
) { |
|||
parent::__construct($responseService); |
|||
$this->service = $service; |
|||
} |
|||
|
|||
/** |
|||
* @param Request $request |
|||
* @return JsonResponse |
|||
*/ |
|||
public function index(Request $request): JsonResponse |
|||
{ |
|||
try { |
|||
$query = ParkingWhitelist::query(); |
|||
|
|||
if ($request->has('license_plate')) { |
|||
$license_plate = $request->input('license_plate'); |
|||
if ($license_plate) { |
|||
$license_plate_id = ParkingLicensePlate::getValueId( |
|||
$license_plate |
|||
); |
|||
if ($license_plate_id) { |
|||
$query->where('license_plate_id', $license_plate_id); |
|||
} else { |
|||
$query->where('id', 0); |
|||
} |
|||
} |
|||
} |
|||
|
|||
// 分页 |
|||
$page = $request->input('page', 1); |
|||
$perPage = $request->input('per_page', 10); |
|||
|
|||
$total = $query->count(); |
|||
$items = $query->latest()->forPage($page, $perPage)->get()->each( |
|||
function ($item) { |
|||
return $this->service->getItem($item); |
|||
} |
|||
); |
|||
|
|||
return $this->responseService->success([ |
|||
'items' => $items, |
|||
'total' => $total, |
|||
'page' => $page, |
|||
'per_page' => $perPage, |
|||
'last_page' => ceil($total / $perPage), |
|||
]); |
|||
} catch (Exception $e) { |
|||
$m_prefix = __('exception.exception_handler.resource'); |
|||
return $this->responseService->systemError( |
|||
$m_prefix . ':' . $e->getMessage() |
|||
); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @return JsonResponse |
|||
*/ |
|||
public function create(): JsonResponse |
|||
{ |
|||
try { |
|||
$data = [ |
|||
'parking_list' => Parking::getData(), |
|||
'member_type_list' => ParkingSpaceType::getData(), |
|||
'channel_list' => ParkingChannel::getData() |
|||
]; |
|||
return $this->responseService->success($data); |
|||
} catch (Exception $e) { |
|||
return $this->responseService->systemError( |
|||
__('exception.get_data_failed') . ':' . $e->getMessage() |
|||
); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @param string $id |
|||
* @return JsonResponse |
|||
*/ |
|||
public function edit(string $id): JsonResponse |
|||
{ |
|||
try { |
|||
$this->validateId($id, ParkingWhitelist::class); |
|||
$data = [ |
|||
'parking_list' => Parking::getData(), |
|||
'member_type_list' => ParkingSpaceType::getData(), |
|||
'channel_list' => ParkingChannel::getData() |
|||
]; |
|||
$item = ParkingWhitelist::query()->find($id); |
|||
$item['license_plate'] = ParkingLicensePlate::getNumber( |
|||
$item['license_plate_id'] |
|||
); |
|||
unset( |
|||
$item['license_plate_id'], |
|||
$item['admin_user_id'], |
|||
$item['created_at'], |
|||
$item['status'] |
|||
); |
|||
$data['item'] = $item; |
|||
return $this->responseService->success($data); |
|||
} catch (Exception $e) { |
|||
return $this->responseService->systemError( |
|||
__('exception.get_data_failed') . ':' . $e->getMessage() |
|||
); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @param Request $request |
|||
* @param string $id |
|||
* @return JsonResponse |
|||
* @throws CustomException |
|||
* @throws ValidationException |
|||
*/ |
|||
public function update(Request $request, string $id): JsonResponse |
|||
{ |
|||
try { |
|||
$data = $request->all(); |
|||
$this->saveValidator($data, $id); |
|||
$data['admin_user_id'] = $this->adminUserId; |
|||
$this->service->updateModel($data, $id); |
|||
return $this->responseService->success( |
|||
null, |
|||
__('admin.update_succeeded') |
|||
); |
|||
} catch (ValidationException|CustomException $e) { |
|||
throw $e; |
|||
} catch (Exception $e) { |
|||
return $this->responseService->systemError( |
|||
__('admin.operation_failed') . ':' |
|||
. $e->getMessage() |
|||
); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @param array $data |
|||
* @param int $id |
|||
* @return void |
|||
* @throws ValidationException |
|||
*/ |
|||
protected function saveValidator(array $data, int $id = 0): void |
|||
{ |
|||
$rules = [ |
|||
'license_plate' => 'required', |
|||
'parking_id' => 'required', |
|||
'reason' => 'required', |
|||
'channel_ids' => 'required|array' |
|||
]; |
|||
$messages = [ |
|||
'license_plate.required' => __( |
|||
'validation.channel_management.l_empty' |
|||
), |
|||
'parking_id.required' => __( |
|||
'validation.channel_management.pa_empty' |
|||
), |
|||
'reason.required' => __( |
|||
'validation.channel_management.n_empty' |
|||
), |
|||
'channel_ids.required' => __( |
|||
'validation.channel_permissions.c_empty' |
|||
), |
|||
'channel_ids.array' => __( |
|||
'validation.channel_permissions.c_array' |
|||
) |
|||
]; |
|||
if ($id) { |
|||
$this->validateId($id, ParkingChannel::class); |
|||
} |
|||
$validator = Validator::make($data, $rules, $messages); |
|||
|
|||
if ($validator->fails()) { |
|||
throw new ValidationException($validator); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @param string $id |
|||
* @return JsonResponse |
|||
* @throws CustomException |
|||
* @throws ValidationException |
|||
*/ |
|||
public function destroy(string $id): JsonResponse |
|||
{ |
|||
try { |
|||
$this->validateId($id, ParkingWhitelist::class); |
|||
$this->service->deleteModel($id); |
|||
return $this->responseService->success( |
|||
null, |
|||
__('admin.delete_succeeded') |
|||
); |
|||
} catch (ValidationException|CustomException $e) { |
|||
throw $e; |
|||
} catch (Exception $e) { |
|||
return $this->responseService->systemError( |
|||
__('admin.operation_failed') . ':' |
|||
. $e->getMessage() |
|||
); |
|||
} |
|||
} |
|||
|
|||
public function downloadTemplate() |
|||
{ |
|||
return Excel::download( |
|||
new ParkingWhitelistTemplateExport(), |
|||
set_space_underline(__exports('whitelist.list')) |
|||
. get_datetime('date_') |
|||
. '.xlsx' |
|||
); |
|||
} |
|||
|
|||
public function batchImport(Request $request) |
|||
{ |
|||
try { |
|||
// 1. 验证上传的文件 |
|||
$data = $request->all(); |
|||
$validator = Validator::make($data, [ |
|||
'file' => 'required|mimes:xlsx,xls,csv,txt|max:2048' |
|||
], [ |
|||
'file.required' => __validation('admin_list_vip.file_empty'), |
|||
'file.mimes' => __validation('admin_list_vip.file_mimes'), |
|||
'file.max' => __validation('admin_list_vip.file_max') |
|||
]); |
|||
if ($validator->fails()) { |
|||
throw new ValidationException($validator); |
|||
} |
|||
|
|||
// 2. 获取上传的文件 |
|||
$file = $request->file('file'); |
|||
|
|||
// 3. 正确的做法:先存储文件,再获取绝对路径进行导入 |
|||
$path = $file->store('imports'); |
|||
|
|||
// 4. 执行导入(使用存储后的绝对路径) |
|||
// storage_path('app') 获取 storage/app 的绝对路径 |
|||
Excel::import( |
|||
new ParkingWhitelistImport($this->adminUserId), |
|||
storage_path('app/' . $path) |
|||
); |
|||
|
|||
// 5. (可选)导入完成后删除临时文件 |
|||
Storage::delete($path); |
|||
|
|||
return $this->responseService->success( |
|||
__('controller.import.success') |
|||
); |
|||
} catch (ValidationException $e) { |
|||
throw $e; |
|||
} catch (Exception $e) { |
|||
return $this->responseService->systemError( |
|||
__('exception.admin_vip_list.import_failed') . ':' |
|||
. $e->getMessage() |
|||
); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @param Request $request |
|||
* @return JsonResponse |
|||
* @throws CustomException |
|||
* @throws ValidationException |
|||
*/ |
|||
public function store(Request $request): JsonResponse |
|||
{ |
|||
try { |
|||
$data = $request->all(); |
|||
$this->saveValidator($data); |
|||
$data['admin_user_id'] = $this->adminUserId; |
|||
$this->service->createModel($data); |
|||
return $this->responseService->success( |
|||
null, |
|||
__('admin.save_succeeded') |
|||
); |
|||
} catch (ValidationException|CustomException $e) { |
|||
throw $e; |
|||
} catch (Exception $e) { |
|||
return $this->responseService->systemError( |
|||
__('admin.operation_failed') . ':' |
|||
. $e->getMessage() |
|||
); |
|||
} |
|||
} |
|||
|
|||
public function export() |
|||
{ |
|||
return Excel::download( |
|||
new ParkingWhitelistExport(), |
|||
set_space_underline(__exports('whitelist.export_list')) |
|||
. get_datetime('date_') |
|||
. '.xlsx' |
|||
); |
|||
} |
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
<?php |
|||
|
|||
namespace App\Imports; |
|||
|
|||
use App\Models\Parking; |
|||
use App\Models\ParkingChannel; |
|||
use App\Models\ParkingSpaceType; |
|||
use App\Services\OperationLogService; |
|||
use App\Services\ParkingWhitelistService; |
|||
use Maatwebsite\Excel\Concerns\ToModel; |
|||
use Maatwebsite\Excel\Concerns\WithChunkReading; |
|||
class ParkingWhitelistImport implements ToModel, WithChunkReading |
|||
{ |
|||
protected int $index = 1; |
|||
protected int $user_id; |
|||
|
|||
public function __construct($admin_user_id) |
|||
{ |
|||
$this->user_id = $admin_user_id; |
|||
} |
|||
|
|||
public function model(array $row) |
|||
{ |
|||
if ($this->index == 1) { |
|||
$this->index += 1; |
|||
return; |
|||
} |
|||
$license_plate = $row[1]; |
|||
if (empty($license_plate)) { |
|||
return; |
|||
} |
|||
$parking_name = $row[2]; |
|||
if (empty($parking_name)) { |
|||
return; |
|||
} |
|||
$parking_id = Parking::getValueId($parking_name); |
|||
if (empty($parking_id)) { |
|||
return; |
|||
} |
|||
$channel_name = $row[3]; |
|||
if (empty($channel_name)) { |
|||
return; |
|||
} |
|||
$channel_arr = explode(',', $channel_name); |
|||
$channelIds = ParkingChannel::query()->whereIn('name', $channel_arr)->pluck('id')->toArray(); |
|||
if (empty($channelIds)) { |
|||
return; |
|||
} |
|||
$reason = $row[4]; |
|||
if (empty($reason)) { |
|||
return; |
|||
} |
|||
$type_str = $row[5]; |
|||
$space_type_id = 0; |
|||
if (!empty($type_str)) { |
|||
$space_type_id = ParkingSpaceType::getValueId($type_str); |
|||
} |
|||
|
|||
$data = [ |
|||
'license_plate' => $license_plate, |
|||
'parking_id' => $parking_id, |
|||
'reason' => $reason, |
|||
'channel_ids' => $channelIds, |
|||
'admin_user_id' => $this->user_id, |
|||
'member_type' => $space_type_id |
|||
]; |
|||
|
|||
$service = new ParkingWhitelistService(new OperationLogService()); |
|||
$service->createModel($data); |
|||
$this->index += 1; |
|||
} |
|||
|
|||
public function chunkSize(): int |
|||
{ |
|||
return 1000; // 设置每次处理的行数,有助于避免内存问题并可能改善表头解析 |
|||
} |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
<?php |
|||
|
|||
namespace App\Models; |
|||
|
|||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
use Illuminate\Database\Eloquent\SoftDeletes; |
|||
|
|||
class ParkingWhitelist extends Model |
|||
{ |
|||
use HasFactory, SoftDeletes; |
|||
|
|||
protected $table = 'parking_whitelist'; |
|||
|
|||
protected $fillable |
|||
= [ |
|||
'license_plate_id', |
|||
'parking_id', |
|||
'member_type', |
|||
'admin_user_id', |
|||
'channel_ids', |
|||
'reason', |
|||
'status' |
|||
]; |
|||
|
|||
protected $hidden |
|||
= [ |
|||
'updated_at', |
|||
'deleted_at' |
|||
]; |
|||
|
|||
public function getChannelIdsAttribute($value): array |
|||
{ |
|||
return $value ? explode(',', $value) : []; |
|||
} |
|||
|
|||
public function getCreatedAtAttribute($value): string |
|||
{ |
|||
return $value ? date('Y-m-d H:i:s', strtotime($value)) : ''; |
|||
} |
|||
} |
|||
@ -0,0 +1,176 @@ |
|||
<?php |
|||
|
|||
namespace App\Services; |
|||
|
|||
use App\Models\AdminUsers; |
|||
use App\Models\Parking; |
|||
use App\Models\ParkingChannel; |
|||
use App\Models\ParkingLicensePlate; |
|||
use App\Models\ParkingSpaceType; |
|||
use App\Models\ParkingWhitelist; |
|||
use Exception; |
|||
use Illuminate\Support\Facades\DB; |
|||
|
|||
class ParkingWhitelistService extends BaseService |
|||
{ |
|||
protected string $menuTitle = 'whitelist'; |
|||
|
|||
public static function getItemData($item) |
|||
{ |
|||
$service = new self(new OperationLogService()); |
|||
return $service->getItem($item); |
|||
} |
|||
|
|||
public function getItem($item) |
|||
{ |
|||
$item['license_plate'] = ParkingLicensePlate::getNumber( |
|||
$item['license_plate_id'] |
|||
); |
|||
$item['parking'] = Parking::getName($item['parking_id']); |
|||
$channel_list = ParkingChannel::getChannelData( |
|||
$item['channel_ids'] |
|||
); |
|||
$item['channel_str'] = ''; |
|||
if ($channel_list) { |
|||
$channel_arr = array_column((array)$channel_list, 'name'); |
|||
$item['channel_str'] = implode(',', $channel_arr); |
|||
} |
|||
$item['member_type_str'] |
|||
= ParkingSpaceType::getName($item['member_type']); |
|||
$item['admin_username'] = AdminUsers::getUsername( |
|||
$item['admin_user_id'] |
|||
); |
|||
unset( |
|||
$item['license_plate_id'], |
|||
$item['parking_id'], |
|||
$item['channel_ids'], |
|||
$item['member_type'], |
|||
$item['admin_user_id'], |
|||
$item['status'] |
|||
); |
|||
return $item; |
|||
} |
|||
|
|||
/** |
|||
* @param array $data |
|||
* @throws Exception |
|||
*/ |
|||
public function createModel(array $data) |
|||
{ |
|||
try { |
|||
DB::beginTransaction(); |
|||
|
|||
$license_plate = $data['license_plate']; |
|||
$LicensePlate = new ParkingLicensePlateService($this->logService); |
|||
$license_plate_id = $LicensePlate->saveNumber($license_plate); |
|||
|
|||
$existsWhere = [ |
|||
['license_plate_id', '=', $license_plate_id] |
|||
]; |
|||
if (ParkingWhitelist::query()->where($existsWhere)->exists()) { |
|||
throw new Exception( |
|||
__service($this->menuTitle . '.number_exists') |
|||
); |
|||
} |
|||
|
|||
$channel_ids = implode(',', $data['channel_ids']); |
|||
$model = ParkingWhitelist::query()->create([ |
|||
'license_plate_id' => $license_plate_id, |
|||
'parking_id' => $data['parking_id'], |
|||
'member_type' => $data['member_type'] ?? 0, |
|||
'admin_user_id' => $data['admin_user_id'], |
|||
'channel_ids' => $channel_ids ?? '', |
|||
'reason' => $data['reason'], |
|||
'created_at' => get_datetime() |
|||
]); |
|||
|
|||
$this->logService->logCreated( |
|||
$model, |
|||
$this->menuTitle . '.create' |
|||
); |
|||
|
|||
DB::commit(); |
|||
return $model; |
|||
} catch (Exception $e) { |
|||
DB::rollBack(); |
|||
throw $e; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @param array $data |
|||
* @param int $id |
|||
* @throws Exception |
|||
*/ |
|||
public function updateModel(array $data, int $id) |
|||
{ |
|||
try { |
|||
DB::beginTransaction(); |
|||
|
|||
$license_plate = $data['license_plate']; |
|||
$LicensePlate = new ParkingLicensePlateService($this->logService); |
|||
$license_plate_id = $LicensePlate->saveNumber($license_plate); |
|||
// 验证 |
|||
$existsWhere = [ |
|||
['license_plate_id', '=', $license_plate_id], |
|||
['id', '<>', $id] |
|||
]; |
|||
if (ParkingWhitelist::query()->where($existsWhere)->exists()) { |
|||
throw new Exception( |
|||
__service($this->menuTitle . '.number_exists') |
|||
); |
|||
} |
|||
|
|||
// 更新 |
|||
$model = ParkingWhitelist::query()->findOrFail($id); |
|||
$oldValues = $model->toArray(); |
|||
|
|||
$channel_ids = implode(',', $data['channel_ids']); |
|||
$model->update([ |
|||
'license_plate_id' => $license_plate_id, |
|||
'parking_id' => $data['parking_id'], |
|||
'member_type' => $data['member_type'] ?? 0, |
|||
'admin_user_id' => $data['admin_user_id'], |
|||
'channel_ids' => $channel_ids ?? '', |
|||
'reason' => $data['reason'], |
|||
'updated_at' => get_datetime() |
|||
]); |
|||
|
|||
$this->logService->logUpdated( |
|||
$model, |
|||
$oldValues, |
|||
$this->menuTitle . '.update' |
|||
); |
|||
|
|||
DB::commit(); |
|||
return $model; |
|||
} catch (Exception $e) { |
|||
DB::rollBack(); |
|||
throw $e; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @param $id |
|||
* @return bool |
|||
* @throws Exception |
|||
*/ |
|||
public function deleteModel($id): bool |
|||
{ |
|||
try { |
|||
DB::beginTransaction(); |
|||
|
|||
$model = ParkingWhitelist::query()->findOrFail($id); |
|||
|
|||
$this->logService->logDeleted($model, $this->menuTitle . '.delete'); |
|||
|
|||
$model->delete(); |
|||
|
|||
DB::commit(); |
|||
return true; |
|||
} catch (Exception $e) { |
|||
DB::rollBack(); |
|||
throw $e; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Database\Migrations\Migration; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Support\Facades\Schema; |
|||
|
|||
return new class extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
*/ |
|||
public function up(): void |
|||
{ |
|||
Schema::create('parking_whitelist', function (Blueprint $table) { |
|||
$table->id(); |
|||
$table->integer('license_plate_id')->comment('车牌号码'); |
|||
$table->integer('parking_id')->comment('停车场'); |
|||
$table->integer('member_type')->default(0)->comment('身份类型'); |
|||
$table->integer('admin_user_id')->default(0)->comment('操作员'); |
|||
$table->text('channel_ids')->comment('通行通道'); |
|||
$table->string('reason', 300)->default('')->comment('通行原因'); |
|||
$table->tinyInteger('status')->default(1)->comment('状态'); |
|||
$table->timestamps(); |
|||
$table->softDeletes(); |
|||
$table->innoDb(); |
|||
$table->comment('白名单'); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
*/ |
|||
public function down(): void |
|||
{ |
|||
Schema::dropIfExists('parking_whitelist'); |
|||
} |
|||
}; |
|||
Loading…
Reference in new issue