@extends('layouts.admin') @section('title', $role->exists ? 'Edit Role' : 'Create Role') @section('content') @php($canManage = auth()->user()?->hasPermission('roles', 'manage')) @php($current = (array) ($role->permissions ?? [])) @php($isSystem = (bool) $role->is_system) @php($action = $role->exists ? route('admin.roles.update', $role) : route('admin.roles.store'))

{{ $role->exists ? 'Edit Role' : 'Create Role' }}

@if($role->exists) {{ $role->name }} · {{ $role->users_count ?? $role->users()->count() }} user(s) @if($role->is_system) · System@endif @else Define a new reusable role with module-level permissions. @endif

Back
@if($isSystem)
This is a system role. The name is locked; you can still adjust permissions and description.
@endif
@csrf @if($role->exists) @method('PUT') @endif
Shown in user assignment dropdowns.

Module Permissions
@foreach($modules as $key => $module) @php($granted = (array) (old('permissions.'.$key, $current[$key] ?? []))) @endforeach
Module Allowed Actions
{{ $module['label'] }}
{{ $key }}
@foreach(($module['actions'] ?? []) as $a)
@endforeach
@if($canManage) @endif Cancel

Tip: Granting manage automatically implies create / edit / delete. view only allows read access.

@endsection