Files
termanager2/app/Providers/AppServiceProvider.php
Francesco Picone 701f479b7f Primo commit
2026-04-05 19:26:04 +02:00

28 lines
598 B
PHP

<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Artisan;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
//
}
public function boot(): void
{
// Auto-generate APP_KEY if missing
if (empty(config('app.key'))) {
Artisan::call('key:generate', ['--force' => true]);
}
Gate::before(function ($user, $ability) {
return $user->hasRole('amministratore') ? true : null;
});
}
}