<?php
use App\Models\Permission;
use App\Models\Role;
?>

<div class="row">
  <div class="col mb-4">
    <div class="card">
      <div class="card-header">{{ $user->full_name }} - Ruoli e permessi</div>
      <div class="card-body">

        {!! Form::open(['method' => 'POST', 'route' => ['user.updateRole']]) !!}
        {!! Form::hidden('user_id', $user->id) !!}


        <ul style="list-style-type:none">
          @foreach(Role::orderBy('name', 'ASC')->get() as $role)
          <li>{!! Form::checkbox('ruolo[]', $role->id, $user->hasRole($role->name), ['class' => '']) !!} {{ $role->display_name }}</li>
          @endforeach
        </ul>

        {!! Form::submit('Salva', ['class' => 'btn btn-primary form-control']) !!}
        {!! Form::close() !!}

      </div>
    </div>
  </div>
</div>
