%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/dsr_code/app/Providers/
Upload File :
Create Path :
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;
        });
    }
}

Zerion Mini Shell 1.0