-
app/Http/Controllers/RolesController.php
Open in GitHubuse App\Models\Permission; use App\Models\Integration; class RolesController extends Controller { // public function show($external_id) { $permissions_grouping = Permission::all()->groupBy('grouping'); if (!Integration::whereApiType('file')->first()) { unset($permissions_grouping['document']); } return view('roles.show') ->withRole(Role::whereExternalId($external_id)->first()) ->with('permissions_grouping', $permissions_grouping); } // }
-
resources/views/roles/show.blade.php
Open in GitHub// @foreach($permissions_grouping as $permissions) <div class="row"> @if($permissions->first) <div class="col-md-2"> <p class="calm-header">{{ucfirst(__($permissions->first()->grouping))}} </p> </div> @endif <div class="col-md-9"> @foreach($permissions as $permission) <div class="col-xs-6 col-md-6"> <?php $isEnabled = !current( array_filter( $role->permissions->toArray(), function ($element) use ($permission) { return $element['id'] === $permission->id; } ) ); ?> <div class="white-box"> <input type="checkbox" {{ !$isEnabled ? 'checked' : ''}} name="permissions[ {{ $permission->id }} ]" value="1" data-role="{{ $role->id }}"> <span class="perm-name lead"><small>{{ $permission->display_name }}</small></span><br/> {{ $permission->description }} </div> </div> @endforeach //