Support the ongoing development of →
Authentication Blade
Last updated 1 year ago.

Did you ever get this figured out? It is not working for me as well.


Just for reference, here is what I am doing that does not work. Mind you, the policy works in the controller so I know that I have the policy set up correctly:


public function create($user)
    return $user->UGID >= 1;


    public function getCreate()
    $this->authorize('create', Message::class);

    return view('messages.create');


@can('create', Message::class)
    <div>Create Message</div>
    <div>Cannot Create Message</div>

Whenever I visit the create page, I always get the cannot create message no matter what UGID I have. It's not even hitting the policy to check. But the controller check does work.

Last updated 7 years ago.

I discovered that you need to use the full namespace with the class within the blade template like so:

@can('create', App\Message::class)
Last updated 7 years ago.

Oh, sorry. I have not been accessing for while. I gotta do what you are saying and "Mark it as Solution" after that.

Thank you btw.


Thank you @r0bdiabl0 . This should really be mentioned in the documentation. Laravel 5.4 also has this issue


Yay for PHP namespacing.

Last updated 6 years ago.

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

lucasctd lucasctd Joined 18 Dec 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.