36 lines
690 B
PHP
36 lines
690 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
Schema::defaultStringLength(191);
|
|
|
|
Gate::before(function (User $user, string $ability): ?bool {
|
|
if ($user->hasRole('admin', 'api')) {
|
|
return true;
|
|
}
|
|
|
|
return null;
|
|
});
|
|
}
|
|
}
|