2026-10-12 23:47:41 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
2026-10-15 15:03:24 +07:00
|
|
|
use Illuminate\Support\Facades\Gate;
|
2026-10-12 23:47:41 +07:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Register any application services.
|
|
|
|
|
*/
|
|
|
|
|
public function register(): void
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Bootstrap any application services.
|
|
|
|
|
*/
|
|
|
|
|
public function boot(): void
|
|
|
|
|
{
|
2026-10-13 16:21:00 +07:00
|
|
|
\Carbon\Carbon::setLocale('id');
|
2026-10-14 01:38:48 +07:00
|
|
|
date_default_timezone_set(config('app.timezone', 'Asia/Jakarta'));
|
2026-10-15 15:03:24 +07:00
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
});
|
2026-10-12 23:47:41 +07:00
|
|
|
}
|
|
|
|
|
}
|