feat: implement super admin role with spatie rbac and categorize sidebar by management

This commit is contained in:
Ray1111-aa
2026-10-15 15:03:24 +07:00
parent 9c00515a73
commit 2e1f05b494
29 changed files with 5334 additions and 144 deletions
+6
View File
@@ -2,6 +2,7 @@
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@@ -21,5 +22,10 @@ class AppServiceProvider extends ServiceProvider
{
\Carbon\Carbon::setLocale('id');
date_default_timezone_set(config('app.timezone', 'Asia/Jakarta'));
// Super Admin bypass: secara otomatis memiliki izin untuk semua ability
Gate::before(function ($user, $ability) {
return ($user->role === 'super_admin' || $user->hasRole('super_admin')) ? true : null;
});
}
}