SmartCane/laravel_app/app/Providers/AppServiceProvider.php

32 lines
645 B
PHP

<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Blade::if('manager', function () {
return auth()->check() && auth()->user()->hasRole('manager');
});
Blade::if('viewer', function () {
return auth()->check() && auth()->user()->hasRole('viewer');
});
}
}