update api register
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\MenuGroup;
|
||||
use App\Models\MenuList;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
@@ -188,6 +189,40 @@ class MenuListSeeder extends Seeder
|
||||
);
|
||||
}
|
||||
|
||||
$accessApplications = MenuList::updateOrCreate(['slug' => 'role-applications'], [
|
||||
'parent_id' => null, 'name' => 'Permintaan Akses', 'url' => null,
|
||||
'icon' => 'cil-user-follow', 'component' => null, 'sort_order' => 83,
|
||||
]);
|
||||
foreach ([
|
||||
['slug' => 'role-applications-tenants', 'name' => 'Pengajuan Tenant', 'url' => '/access-applications/tenants', 'sort_order' => 1],
|
||||
['slug' => 'role-applications-agents', 'name' => 'Pengajuan Agen', 'url' => '/access-applications/agents', 'sort_order' => 2],
|
||||
['slug' => 'role-applications-staff', 'name' => 'Pengajuan Staff', 'url' => '/access-applications/staff', 'sort_order' => 3],
|
||||
] as $item) {
|
||||
MenuList::updateOrCreate(['slug' => $item['slug']], [
|
||||
'parent_id' => $accessApplications->id, 'name' => $item['name'], 'url' => $item['url'],
|
||||
'icon' => 'cil-user-follow', 'component' => null, 'sort_order' => $item['sort_order'],
|
||||
]);
|
||||
}
|
||||
|
||||
$staffApplicationMenu = MenuList::where('slug', 'role-applications-staff')->firstOrFail();
|
||||
$groupManagementMenu = MenuList::where('slug', 'users-group-menus')->first();
|
||||
if ($groupManagementMenu) {
|
||||
MenuGroup::query()
|
||||
->whereNull('tenant_id')
|
||||
->where('is_system', true)
|
||||
->whereHas('menus', fn ($query) => $query->whereKey($groupManagementMenu->id))
|
||||
->each(function ($group) use ($accessApplications, $staffApplicationMenu) {
|
||||
$permissions = [
|
||||
'can_view' => true, 'can_create' => false, 'can_update' => false,
|
||||
'can_delete' => false, 'can_approve' => true, 'can_export' => false,
|
||||
];
|
||||
$group->menus()->syncWithoutDetaching([
|
||||
$accessApplications->id => $permissions,
|
||||
$staffApplicationMenu->id => $permissions,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
$paymentGateway = MenuList::updateOrCreate(
|
||||
['slug' => 'payment-gateway'],
|
||||
[
|
||||
@@ -206,10 +241,28 @@ class MenuListSeeder extends Seeder
|
||||
}
|
||||
|
||||
MenuList::updateOrCreate(['slug' => 'wallet'], [
|
||||
'parent_id' => null, 'name' => 'Dompet', 'url' => '/wallet',
|
||||
'parent_id' => null, 'name' => 'Saldo Deposit', 'url' => '/deposit-balance',
|
||||
'icon' => 'cil-wallet', 'component' => null, 'sort_order' => 81,
|
||||
]);
|
||||
|
||||
$voucherHotspot = MenuList::updateOrCreate(
|
||||
['slug' => 'voucher-hotspot'],
|
||||
[
|
||||
'parent_id' => null, 'name' => 'Voucher Hotspot', 'url' => null,
|
||||
'icon' => 'cil-barcode', 'component' => null, 'sort_order' => 82,
|
||||
]
|
||||
);
|
||||
foreach ([
|
||||
['slug' => 'voucher-hotspot-sales', 'name' => 'Jual Voucher', 'url' => '/voucher-hotspot/sales', 'sort_order' => 1],
|
||||
['slug' => 'voucher-hotspot-agents', 'name' => 'Agen Voucher', 'url' => '/voucher-hotspot/agents', 'sort_order' => 2],
|
||||
['slug' => 'voucher-hotspot-login-page', 'name' => 'Voucher LoginPage', 'url' => '/voucher-hotspot/login-page', 'sort_order' => 3],
|
||||
] as $item) {
|
||||
MenuList::updateOrCreate(['slug' => $item['slug']], [
|
||||
'parent_id' => $voucherHotspot->id, 'name' => $item['name'], 'url' => $item['url'],
|
||||
'icon' => 'cil-barcode', 'component' => null, 'sort_order' => $item['sort_order'],
|
||||
]);
|
||||
}
|
||||
|
||||
$nas = MenuList::updateOrCreate(
|
||||
['slug' => 'nas'],
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user