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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user