Files
2026-09-02 17:08:57 +00:00

21 lines
1.7 KiB
PHP
Executable File

<x-layouts::app :title="$role->exists ? __('Edit Role') : __('Create Role')">
<div class="hd-page-shell space-y-5">
<section class="hd-page-hero"><div><div class="hd-eyebrow">Administration</div><h1>{{ $role->exists ? 'Edit role' : 'Create role' }}</h1><p>Define the role and the permissions it grants.</p></div><a class="hd-action" href="{{ route('user-management.roles') }}">Back</a></section>
@if($errors->any())<div class="hd-alert hd-alert-danger"><ul>@foreach($errors->all() as $error)<li>{{ $error }}</li>@endforeach</ul></div>@endif
<form method="POST" action="{{ $role->exists ? route('user-management.roles.update', $role) : route('user-management.roles.store') }}" class="hd-panel p-6 space-y-6">
@csrf @if($role->exists) @method('PUT') @endif
<div class="hd-form-grid">
<label class="hd-field"><span>Name</span><input name="name" value="{{ old('name', $role->name) }}" required></label>
<label class="hd-field"><span>Slug</span><input name="slug" value="{{ old('slug', $role->slug) }}" placeholder="auto-generated"></label>
</div>
<label class="hd-field"><span>Description</span><textarea name="description">{{ old('description', $role->description) }}</textarea></label>
<div><h2 class="mb-3 text-lg font-semibold">Permissions</h2><div class="hd-role-options">
@foreach($permissions as $permission)
<label><input type="checkbox" name="permissions[]" value="{{ $permission->id }}" @checked(in_array($permission->id, old('permissions', $role->exists ? $role->permissions->pluck('id')->all() : [])))><span><strong>{{ $permission->name }}</strong><small>{{ $permission->slug }}</small></span></label>
@endforeach
</div></div>
<div class="flex justify-end"><button class="hd-action hd-action-blue" type="submit">Save role</button></div>
</form>
</div>
</x-layouts::app>