I am using entrust in my laravel project. In blade file when I edit a role I want to display all the permissions with checkbox.
But I stuck at the thought that I want the checkbox status is checked if the role has the permission.I pass the role and all permissions to blade ,and try
@foreach($permissions as $permission)
<input type="checkbox" value="{{$permission->name}}"
@if($role->hasPermission($permission->name))
checked="checked"
@endif
@endforeach
but it didn't work
I also try convert $role and $permissions to array and pass them to blade and use foreach twice ,it didn't work either. Is there any way to make it?