@php $isEdit = isset($role) && $role->exists && $role->id; $formAction = $isEdit ? route('admin.roles.update', $role->id) : route('admin.roles.store'); $formMethod = $isEdit ? 'PUT' : 'POST'; $formTitle = $isEdit ? 'Edit Role' : 'Create Role'; $submitText = $isEdit ? 'Update Role' : 'Save Role'; // Get selected permissions $selectedPermissions = []; if ($isEdit && $role->permissions) { $selectedPermissions = is_array($role->permissions) ? $role->permissions : (json_decode($role->permissions, true) ?? []); } @endphp @if ($errors->any())
Validation Errors!
@endif

{{ $formTitle }}

Back to List
@csrf @if($isEdit) @method('PUT') @endif
Basic Information
@error('name') {{ $message }} @enderror
{{ url('/') }}/role/
@error('slug') {{ $message }} @enderror
Preview: @if(isset($role) && $role->slug) {{ $role->slug }} @else auto-generated @endif
@error('description') {{ $message }} @enderror
is_default ?? 0) ? 'checked' : '' }} style="width: 18px; height: 18px; accent-color: #C1121F; cursor: pointer;">
Default roles cannot be deleted
Permissions
@foreach($permissions as $module => $actions)
{{ ucfirst(str_replace('_', ' ', $module)) }}
@foreach($actions as $action)
@endforeach
@endforeach
Cancel