@extends('layouts.backend') @section('content')

{{ $mode === 'edit' ? __('Edit User') : __('Add User') }}

@include('partials.flash')
@csrf @if($mode === 'edit') @method('PUT') @endif
@if($mode === 'create') {{ __('If blank, a secure password will be auto-generated and sent by email.') }} @endif
@php($assignedRoleIds = collect(old('role_ids', isset($user) ? $user->roles->pluck('id')->all() : []))->map(fn($id) => (int) $id)->all())
@foreach($roles as $role)
@php($checkboxId = 'role_'.$role->id)
id, $assignedRoleIds, true) ? 'checked' : '' }}>
@endforeach
{{ __('Back') }}
@endsection