jeudi 29 octobre 2015

Laravel: Gate::denies not working

So I am trying to use Laravel Authorization. For here I did following:

  • Laravel updated to *.1.19
  • Create The Policies Directory
  • Facade defined in app.php

I created a Policy and put following code in it:

//Allow users of type 'users`    
public function view(User $user)
        {
            dd('he was here'); // Not coming here
            return $user->user_type === 'user';
        }

In Controller I did:

if (Gate::denies('view')) {
            dd('Sorry Bud not allowed');
        }

Thing is, it is always getting into blocks 'Sorry Bud not allowed'.

Am I missing some step or something else?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire