mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
0123d83fb2
User roles would only be actioned if they existed in the form request, hence removal of all roles would have no data to action upon. This adds a placeholder 0-id role to ensure there is always role data to send, even when no roles are selected. This field value is latter filtered out. Added test to cover. Likely related to #3922.
18 lines
641 B
PHP
18 lines
641 B
PHP
|
|
<div class="toggle-switch-list dual-column-content">
|
|
<input type="hidden" name="{{ $name }}[0]" value="0">
|
|
@foreach($roles as $role)
|
|
<div>
|
|
@include('form.custom-checkbox', [
|
|
'name' => $name . '[' . strval($role->id) . ']',
|
|
'label' => $role->display_name,
|
|
'value' => $role->id,
|
|
'checked' => old($name . '.' . strval($role->id)) || (!old('name') && isset($model) && $model->hasRole($role->id))
|
|
])
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
@if($errors->has($name))
|
|
<div class="text-neg text-small">{{ $errors->first($name) }}</div>
|
|
@endif |