%PDF- %PDF-
Direktori : /home/silvzytp/dsr_code/app/Providers/ |
Current File : /home/silvzytp/dsr_code/app/Providers/AppServiceProvider.php |
<?php namespace App\Providers; use App\Models\User; use App\Models\Permission; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { /** * Register any application services. * * @return void */ public function register() { // } /** * Bootstrap any application services. * * @return void */ public function boot() { Blade::if('permission', function ($permission){ return Auth::user()->role->permissions->where('slug',$permission)->first() ? true : false; }); Blade::if('super_admin', function ($role_slug) { return Auth::user()->role->slug == $role_slug ? true : false; }); } }