@extends('admin.layout.template') @section('title','Edit Role') @section('content')
@csrf {{-- Role Info --}}

Edit Role

is_locked ? 'checked' : '' }}>
{{-- Permissions --}} @foreach($permissions as $module => $perms)

{{ ucfirst($module) }}

Module
Add
View
Update
Delete
@php $actions = ['add','view','update','delete']; $actionAliases = [ 'add' => ['add','create','store'], 'view' => ['view','index','show'], 'update' => ['update','edit'], 'delete' => ['delete','destroy'], ]; $normalize = fn($v) => strtolower(str_replace(['-','.','_'],'',$v)); @endphp
{{ str_replace('-', ' ', $module) }}
@foreach($actions as $action) @php $permissionName = null; $moduleVariants = [$module, \Illuminate\Support\Str::plural($module)]; foreach ($perms as $perm) { $permNorm = $normalize($perm); foreach ($moduleVariants as $mod) { $modNorm = $normalize($mod); if (!str_contains($permNorm, $modNorm)) continue; foreach ($actionAliases[$action] as $alias) { if (str_contains($permNorm, $normalize($alias))) { $permissionName = $perm; break 3; } } if ( $action === 'view' && ($permNorm === $modNorm || str_ends_with($perm, '.index')) ) { $permissionName = $perm; break 2; } } } @endphp
@if($permissionName) @endif
@endforeach
@endforeach
@endsection