Files
GSB-Construction/app/Providers/AppServiceProvider.php
Ajjj 936ae1c6b2
Some checks failed
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
Tests / PHP 8.5 (push) Has been cancelled
feat: implement comprehensive dashboard controller and modular administrative and project management interfaces
2026-08-03 18:28:52 +08:00

40 lines
963 B
PHP

<?php
namespace App\Providers;
use Illuminate\Support\Facades\Vite;
use Illuminate\Support\ServiceProvider;
use App\Models\User;
use App\Observers\UserObserver;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Vite::prefetch(concurrency: 3);
User::observe(UserObserver::class);
// Implicitly grant all permissions to Super Admins and System Admins
\Illuminate\Support\Facades\Gate::before(function ($user, $ability) {
if ($user->user_type === 'admin' ||
$user->hasRole('Super Admin') ||
$user->hasRole('admin') ||
$user->hasRole('Main Contractor Admin')) {
return true;
}
return null;
});
}
}