Handle undefined user scenario in role input

Added a conditional check to handle cases where the user is undefined when rendering role input fields. This ensures that the role selection logic works correctly for both new user creation and existing user updates.
This commit is contained in:
Daeng Deni Mardaeni
2024-10-31 11:39:34 +07:00
parent b185a60b53
commit a25194dc07

View File

@@ -169,7 +169,11 @@
</div>
</div>
<div class="switch switch-sm">
@if(isset($user))
<input {{ in_array($role->name,$user->roles->pluck("name")->toArray()) ? 'checked' : '' }} name="roles" type="radio" value="{{ $role->name }}">
@else
<input name="roles" type="radio" value="{{ $role->name }}">
@endif
</div>
</div>
@endforeach