big update all menus

This commit is contained in:
Wian Drs
2026-08-07 09:16:13 +07:00
parent 75342dc7b7
commit e7575ba1c0
101 changed files with 3451 additions and 89 deletions
+9
View File
@@ -119,6 +119,7 @@ class MenuGroupService
DB::raw('COALESCE(mgm.can_update, false) as can_update'),
DB::raw('COALESCE(mgm.can_delete, false) as can_delete'),
DB::raw('COALESCE(mgm.can_approve, false) as can_approve'),
DB::raw('COALESCE(mgm.can_activate, false) as can_activate'),
DB::raw('COALESCE(mgm.can_export, false) as can_export')
)
->orderBy('m.sort_order')
@@ -141,6 +142,7 @@ class MenuGroupService
'can_update' => (bool) $row->can_update,
'can_delete' => (bool) $row->can_delete,
'can_approve' => (bool) $row->can_approve,
'can_activate' => (bool) $row->can_activate,
'can_export' => (bool) $row->can_export,
],
'available_permissions' => [
@@ -149,6 +151,7 @@ class MenuGroupService
'can_update' => true,
'can_delete' => true,
'can_approve' => true,
'can_activate' => true,
'can_export' => true,
],
];
@@ -191,6 +194,7 @@ class MenuGroupService
'can_update' => (bool) ($menu['can_update'] ?? false),
'can_delete' => (bool) ($menu['can_delete'] ?? false),
'can_approve' => (bool) ($menu['can_approve'] ?? false),
'can_activate' => (bool) ($menu['can_activate'] ?? false),
'can_export' => (bool) ($menu['can_export'] ?? false),
'updated_at' => now(),
'created_at' => now(),
@@ -229,6 +233,7 @@ class MenuGroupService
DB::raw('COALESCE(mgm.can_update, false) as can_update'),
DB::raw('COALESCE(mgm.can_delete, false) as can_delete'),
DB::raw('COALESCE(mgm.can_approve, false) as can_approve'),
DB::raw('COALESCE(mgm.can_activate, false) as can_activate'),
DB::raw('COALESCE(mgm.can_export, false) as can_export')
)
->orderBy('m.sort_order')
@@ -249,6 +254,7 @@ class MenuGroupService
'can_update' => (bool) $row->can_update,
'can_delete' => (bool) $row->can_delete,
'can_approve' => (bool) $row->can_approve,
'can_activate' => (bool) $row->can_activate,
'can_export' => (bool) $row->can_export,
],
'available_permissions' => $available,
@@ -278,6 +284,7 @@ class MenuGroupService
->orWhere('mgm.can_update', true)
->orWhere('mgm.can_delete', true)
->orWhere('mgm.can_approve', true)
->orWhere('mgm.can_activate', true)
->orWhere('mgm.can_export', true);
})
->distinct()
@@ -304,6 +311,7 @@ class MenuGroupService
DB::raw('MAX(CASE WHEN mgm.can_update THEN 1 ELSE 0 END) as can_update'),
DB::raw('MAX(CASE WHEN mgm.can_delete THEN 1 ELSE 0 END) as can_delete'),
DB::raw('MAX(CASE WHEN mgm.can_approve THEN 1 ELSE 0 END) as can_approve'),
DB::raw('MAX(CASE WHEN mgm.can_activate THEN 1 ELSE 0 END) as can_activate'),
DB::raw('MAX(CASE WHEN mgm.can_export THEN 1 ELSE 0 END) as can_export')
)
->get()
@@ -313,6 +321,7 @@ class MenuGroupService
'can_update' => (bool) $row->can_update,
'can_delete' => (bool) $row->can_delete,
'can_approve' => (bool) $row->can_approve,
'can_activate' => (bool) $row->can_activate,
'can_export' => (bool) $row->can_export,
]])
->all();