30 lines
621 B
PHP
30 lines
621 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use App\Helpers\RouteCommentDescriptor;
|
|
use Illuminate\Support\Facades\Blade;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
RouteCommentDescriptor::register();
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// add fucntion on blade
|
|
Blade::if('role', function ($name) {
|
|
return auth()->check() && auth()->user()->hasRole($name);
|
|
});
|
|
}
|
|
}
|