{{-- resources/views/roles/assign-permissions.blade.php --}} @extends('layouts.app') @section('title', 'Assign Permissions') @push('styles') @endpush @section('content')

Assign Permissions

Role: {{ $role->display_name }} — tick what this role may do. Children are independent; you don't need to grant a whole group.
Back
@if(session('error'))
{{ session('error') }}
@endif @php // Build a name => id and id-set for current selection, then render from the catalogue (ordered). $idByName = $permissions->pluck('id', 'name'); // 'prison.borstal.view' => 12 $selected = collect($rolePermissions ?? [])->flip(); // id => true $actions = config('permissions.actions'); $groups = config('permissions.groups'); $groupClass = ['prison'=>'pg-prison','probation'=>'pg-probation','independent'=>'pg-independent']; @endphp
@csrf
0 selected
@foreach(['prison','probation','independent'] as $gk) @php $group = $groups[$gk]; @endphp
{{ $group['label'] }} 0 / {{ collect($group['modules'])->sum(fn($m)=>count($m['actions'])) }}
@foreach($actions as $aKey => $aLabel) @endforeach @foreach($group['modules'] as $m) @foreach($actions as $aKey => $aLabel) @php $pname = $m['key'].'.'.$aKey; $pid = $idByName[$pname] ?? null; @endphp @endforeach @endforeach
Module{{ $aLabel }}allAll
{{ $m['label'] }} {{ $m['sub'] ?? $group['label'] }} @if(in_array($aKey, $m['actions']) && $pid) @else — @endif
@endforeach
Saving updates {{ $role->display_name }}’s access. 0 permissions
Cancel
@push('scripts') @endpush @endsection