1 year ago

User and Roles Gate

Posted 1 year ago by murilo

Hello Guys , I use to make a muth authentication like this -

but now in Laravel 5.6 , is not working this type of Authentication , maybe somethis has changed .

In AuthServiceProvider , I have this code -

use Illuminate\Support\Facades\Gate as GateContract;

  public function boot(GateContract $gate)

        foreach ($this->getPermissions() as $permission){

            $gate->define($permission->title , function($user) use ($permission){
                return $user->hasRole($permission->roles);



    protected function getPermissions(){
        return UserPermission::with('roles')->get();

but is giving this error

Class 'App\Providers\Gate' not found

dows some one knows what is happenig ?

Please sign in or create an account to participate in this conversation.