116 lines
3.4 KiB
PHP
116 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use App\Models\AppMenu;
|
|
|
|
class AppMenuSeeder extends Seeder
|
|
{
|
|
public function run()
|
|
{
|
|
// Reset
|
|
AppMenu::truncate();
|
|
|
|
$menus = [
|
|
[
|
|
'label' => 'Dashboard',
|
|
'key' => 'dashboard',
|
|
'icon' => 'HomeIcon', // Adjust with exact icon name used in frontend
|
|
'route' => 'dashboard',
|
|
'order' => 10,
|
|
'is_active' => true,
|
|
],
|
|
[
|
|
'label' => 'GeoTrack',
|
|
'key' => 'geotrack',
|
|
'icon' => 'MapIcon',
|
|
'route' => 'geotrack', // Assuming this triggers internal navigation logic
|
|
'order' => 20,
|
|
'is_active' => true,
|
|
],
|
|
[
|
|
'label' => 'GeoPlan',
|
|
'key' => 'geoplan',
|
|
'icon' => 'CalendarIcon',
|
|
'route' => 'geoplan',
|
|
'order' => 30,
|
|
'is_active' => true,
|
|
],
|
|
[
|
|
'label' => 'Grid Management',
|
|
'key' => 'grid',
|
|
'icon' => 'GridIcon', // ViewGridIcon
|
|
'route' => 'grid',
|
|
'order' => 40,
|
|
'is_active' => true,
|
|
],
|
|
[
|
|
'label' => 'Merchants',
|
|
'key' => 'merchants',
|
|
'icon' => 'ShopIcon', // ShoppingBagIcon
|
|
'route' => 'merchants',
|
|
'order' => 50,
|
|
'is_active' => true,
|
|
],
|
|
[
|
|
'label' => 'Staff Management',
|
|
'key' => 'staff',
|
|
'icon' => 'UsersIcon',
|
|
'route' => 'staff',
|
|
'order' => 60,
|
|
'is_active' => true,
|
|
],
|
|
[
|
|
'label' => 'Customer Management',
|
|
'key' => 'customer',
|
|
'icon' => 'UserGroupIcon',
|
|
'route' => 'customer',
|
|
'order' => 70,
|
|
'is_active' => true,
|
|
],
|
|
// System Submenu
|
|
[
|
|
'label' => 'System Access',
|
|
'key' => 'system',
|
|
'icon' => 'CogIcon',
|
|
'route' => null, // Parent
|
|
'order' => 90,
|
|
'is_active' => true,
|
|
'children' => [
|
|
[
|
|
'label' => 'Menu Management',
|
|
'key' => 'system.menu',
|
|
'icon' => 'MenuIcon',
|
|
'route' => 'system-menu',
|
|
'order' => 1,
|
|
'is_active' => true,
|
|
],
|
|
[
|
|
'label' => 'Role & Permission',
|
|
'key' => 'system.role',
|
|
'icon' => 'ShieldCheckIcon',
|
|
'route' => 'system-role',
|
|
'order' => 2,
|
|
'is_active' => true,
|
|
]
|
|
]
|
|
]
|
|
];
|
|
|
|
foreach ($menus as $m) {
|
|
$children = $m['children'] ?? [];
|
|
unset($m['children']);
|
|
|
|
$parent = AppMenu::create($m);
|
|
|
|
if (!empty($children)) {
|
|
foreach ($children as $c) {
|
|
$c['parent_id'] = $parent->id;
|
|
AppMenu::create($c);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|