Reputation: 1221
I installed Zizaco/entrust
(https://github.com/Zizaco/entrust) with laravel 5.1 and added these in the provider
and aliases
array
'providers' => [
....
Zizaco\Entrust\EntrustServiceProvider::class,
]
'aliases' => [
....
'Entrust' => Zizaco\Entrust\EntrustFacade::class,
]
I can access all the Entrust functionalities from controllers eg: $user->hasRole('admin')
with no problems however when I try this in my view it doesn't work
@role('admin')
....
@endrole
It simply shows @role('admin') @endrole as html. So I tried
@if(\Entrust::role('admin'))
...
@endif
And I get
Call to undefined method Zizaco\Entrust\Entrust::role()
Do I have to perform any additional configuration or changes to make @role
work? Or am I missing something?
Thanks in advance
Upvotes: 2
Views: 1751
Reputation: 1
It works for Laravel 5.1.31 LTS
Upvotes: 0
Reputation: 1221
I couldn't get @roles('admin')
to work but this works
@if(Entrust::hasRole('admin'))
....
@endif
Upvotes: 1