@extends('frontend.layouts.app')

@section('content')
    <div class="container">
        <h1>Asignar Roles</h1>
        @foreach ($users as $user)
            <form action="{{ route('admin.roles.assign', $user) }}" method="POST">
                @csrf
                <h3>{{ $user->name }}</h3>
                @foreach ($roles as $role)
                    <label>
                        <input type="checkbox" name="roles[]" value="{{ $role->name }}" {{ $user->hasRole($role->name) ? 'checked' : '' }}>
                        {{ $role->name }}
                    </label>
                @endforeach
                <button type="submit">Guardar</button>
            </form>
            <hr>
        @endforeach
    </div>
@endsection