Support the ongoing development of Laravel.io →
Eloquent Blade Packages
Last updated 2 years ago.
0

I'm actually looking for similar functionality. Were you ever able to get this one figured out?

0

I suggest you get all permissions first:

Pemission::all() or list()

then on your view, you can iterate over the list with the checkboxes

@foreach($permissions as $permission)
<input type='checkbox' value='{{$permission->id}}' {{$user->can($permission->name) ? 'checked':''}}>{{$permission->name}}</input>
@endforeach

notice the $user->can() will determine if the user has this permission. please note that I typed this directly here without testing the code. adjust accrodingly.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

m-alinasab m-alinasab Joined 14 Sep 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.