jeudi 4 février 2016

Assigning Permissons to Role, frontend

Hello I'm trying to accomplishe some sort of system, where the Admin can change the permissons, for the Manager and Employee roles. I have to admit, i am a bit stuck, and uncertain as to what my next step is. This is what i currently have:

    @foreach($role as $role) 
          <br />  {{$role->name}} <br />
@foreach($permission as $perm)

  {!! Form::checkbox('$perm->id', null, null, []) !!}
  {{$perm->name}}<br />
@endforeach

@endforeach

My controller:

$permission = Permissions::all();
$role = Role::all();
$settings = Settings::findOrFail(1); //Ignore this, it's for something else

return view('settings.index')
->withSettings($settings)
->withPermission($permission)
->withRole($role);

I want it so when the box is checked, the permisson gets attached to the role, and when the box is unchecked it gets detachached.

My tables:

    Role_user
 * role_id
 * user_id

Roles
 * Name
 * Slug
 * Description

Permission
 * Name
 * Slug
 * Description

Permission_role
 * Role_id
 * Permmission_id

I am useing Laravel rbac from phpzen, if that makes any diffrence. I haven't been able to make it but i what i'm trying to do is something liek this:

  public function permmisionsupdate()
    {
        If requested field is checked...
        Attach permission to Role
    If requested field is not checked...
    dettach permission to Role
    }



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1R7fGNM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire