You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
333 lines
12 KiB
333 lines
12 KiB
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use function Illuminate\Events\queueable;
|
|
|
|
class AdminMenuSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
//
|
|
DB::table('admin_menu')->insert($this->data());
|
|
}
|
|
|
|
private function data(): array
|
|
{
|
|
$data = [];
|
|
|
|
$array = $this->returnArray();
|
|
$id = 0;
|
|
foreach ($array as $key => $value) {
|
|
$id += 1;
|
|
$data[] = $this->insertData($id, $key, 1);
|
|
if (is_array($value)) {
|
|
foreach ($value as $k => $v) {
|
|
$parent_id = $id;
|
|
$id += 1;
|
|
$data[] = $this->insertData($id, $k, 1, $parent_id, $v['uri']);
|
|
|
|
$order = 0;
|
|
foreach ($v['child'] as $title => $uri) {
|
|
$parent_id = $id;
|
|
$id += 1;
|
|
$data[] = $this->insertData($id, $title, 0, $parent_id, $uri, $order);
|
|
$order += 1;
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
return $data;
|
|
}
|
|
|
|
private function returnArray():array
|
|
{
|
|
return [
|
|
'model_manage' => [
|
|
'event_calendar' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'add' => '',
|
|
'edit' => '',
|
|
'import' => '',
|
|
'export' => '',
|
|
'delete' => '',
|
|
'batch_delete' => '',
|
|
'download_template' => '',
|
|
'end' => ''
|
|
]
|
|
],
|
|
'model_manage' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'add' => '',
|
|
'edit' => '',
|
|
'batch_import' => '',
|
|
'view_details' => '',
|
|
'download_template' => '',
|
|
'reserved_parking' => '',
|
|
'departure_reminder' => '',
|
|
'add_parking_space' => '',
|
|
'edit_parking_space' => '',
|
|
'delete_parking_space' => ''
|
|
]
|
|
]
|
|
],
|
|
'cat_status' => [
|
|
'cat_map' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'view' => ''
|
|
]
|
|
],
|
|
'cat_list' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'add_new_energy' => '',
|
|
'delete_new_energy' => ''
|
|
]
|
|
],
|
|
'cat_type' => [
|
|
'uri' => 'spaceType',
|
|
'child' => [
|
|
'read_only' => 'spaceType.index',
|
|
'add' => 'spaceType.store',
|
|
'delete' => 'spaceType.delete',
|
|
'view_details' => 'spaceType.show',
|
|
'edit' => 'spaceType.update',
|
|
'download_template' => '',
|
|
'license_plate_management' => 'licensePlate.index',
|
|
'batch_import' => '',
|
|
'add_license_plate' => 'licensePlate.store',
|
|
'delete_license_plate' => 'licensePlate.destroy',
|
|
'edit_license_plate' => 'licensePlate.update',
|
|
'clear_license_plate' => ''
|
|
]
|
|
],
|
|
'cat_attr' => [
|
|
'uri' => 'spaceAttr',
|
|
'child' => [
|
|
'read_only' => 'spaceAttr.index',
|
|
'add' => 'spaceAttr.store',
|
|
'edit' => 'spaceAttr.update',
|
|
'delete' => 'spaceAttr.destroy'
|
|
]
|
|
],
|
|
'draw_map' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => ''
|
|
]
|
|
],
|
|
'parking_information' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'add' => '',
|
|
'clear' => '',
|
|
'delete' => ''
|
|
]
|
|
]
|
|
],
|
|
'special_car_manage' => [
|
|
'vip_list' => [
|
|
'uri' => 'vipList',
|
|
'child' => [
|
|
'read_only' => 'vipList.index',
|
|
'add' => 'vipList.store',
|
|
'edit' => 'vipList.update',
|
|
'delete' => 'vipList.destroy',
|
|
'import' => 'vipList.import',
|
|
'export' => 'vipList.export',
|
|
'download_template' => 'vipList.importTemplate'
|
|
]
|
|
],
|
|
'vip_access_record' => [
|
|
'uri' => 'vipAccessRecord',
|
|
'child' => [
|
|
'read_only' => 'vipAccessRecord.index',
|
|
'view_details' => 'vipAccessRecord.show'
|
|
]
|
|
]
|
|
],
|
|
'information_center' => [
|
|
'alarm_notice' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'view_details' => '',
|
|
'export' => '',
|
|
'alarm_settings' => ''
|
|
]
|
|
]
|
|
],
|
|
'gate_management' => [
|
|
'stop_on_duty' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => ''
|
|
]
|
|
],
|
|
'lane_video' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => ''
|
|
]
|
|
]
|
|
],
|
|
'statistics_report' => [
|
|
'recognition_rate' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'export' => ''
|
|
]
|
|
],
|
|
'parking_behavior' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'export' => '',
|
|
'view_details' => ''
|
|
]
|
|
],
|
|
'utilization_rate' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'export' => ''
|
|
]
|
|
],
|
|
'occupancy_rate' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'export' => ''
|
|
]
|
|
],
|
|
'manual_correction' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'view_details' => '',
|
|
'export' => ''
|
|
]
|
|
]
|
|
],
|
|
'system_log' => [
|
|
'system_log' => [
|
|
'uri' => 'operationLog',
|
|
'child' => [
|
|
'read_only' => 'operationLog.index',
|
|
'export' => 'operationLog.export'
|
|
]
|
|
]
|
|
],
|
|
'device_manage' => [
|
|
'camera_management' => [
|
|
'uri' => '',
|
|
'child' => [
|
|
'read_only' => '',
|
|
'add' => '',
|
|
'edit' => '',
|
|
'delete' => '',
|
|
'import' => '',
|
|
'export' => '',
|
|
'debug' => '',
|
|
'download_template' => ''
|
|
]
|
|
]
|
|
],
|
|
'system_manage' => [
|
|
'total_configuration' => [
|
|
'uri' => 'config',
|
|
'child' => [
|
|
'read_only' => 'config.index',
|
|
'edit' => 'config.update'
|
|
]
|
|
],
|
|
'floor_plan' => [
|
|
'uri' => 'floors',
|
|
'child' => [
|
|
'read_only' => 'floors.index',
|
|
'add_floor' => 'floors.store',
|
|
'edit_floor' => 'floors.update',
|
|
'delete' => 'floors.destroy'
|
|
]
|
|
],
|
|
'translation' => [
|
|
'uri' => 'translations',
|
|
'child' => [
|
|
'read_only' => 'translations.index',
|
|
'add' => 'translations.store',
|
|
'edit' => 'translations.update',
|
|
'delete' => 'translations.destroy'
|
|
]
|
|
]
|
|
],
|
|
'user_manage' => [
|
|
'user_list' => [
|
|
'uri' => 'users',
|
|
'child' => [
|
|
'read_only' => 'users.index',
|
|
'add' => 'users.store',
|
|
'edit' => 'users.update',
|
|
'delete' => 'users.destroy'
|
|
]
|
|
],
|
|
'role_manage' => [
|
|
'uri' => 'roles',
|
|
'child' => [
|
|
'read_only' => 'roles.index',
|
|
'add' => 'roles.store',
|
|
'view' => 'roles.show',
|
|
'edit' => 'roles.update',
|
|
'delete' => 'roles.destroy'
|
|
]
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param int $id
|
|
* @param string $title
|
|
* @param int $show
|
|
* @param int $parent_id
|
|
* @param string $uri
|
|
* @param int $order
|
|
* @return array
|
|
*/
|
|
private function insertData(
|
|
int $id,
|
|
string $title,
|
|
int $show = 0,
|
|
int $parent_id = 0,
|
|
string $uri = '#',
|
|
int $order = 0
|
|
): array {
|
|
return [
|
|
'id' => $id,
|
|
'parent_id' => $parent_id,
|
|
'order' => $order,
|
|
'title' => $title,
|
|
'icon' => '',
|
|
'uri' => $uri,
|
|
'show' => $show,
|
|
'created_at' => date("Y-m-d H:i:s", time())
|
|
];
|
|
}
|
|
}
|
|
|