Skip to content

Commit 513f140

Browse files
authored
Merge pull request #24 from RalphvK/master
Fix "Trying to get property 'id' of non-object" error when editing user without roles
2 parents b84b943 + 1df383c commit 513f140

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/resources/views/usersmanagement/edit-user.blade.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@
108108
<option value="">{{ trans('laravelusers::forms.create_user_ph_role') }}</option>
109109
@if ($roles)
110110
@foreach($roles as $role)
111-
<option value="{{ $role->id }}" {{ $currentRole->id == $role->id ? 'selected="selected"' : '' }}>{{ $role->name }}</option>
111+
@if ($currentRole)
112+
<option value="{{ $role->id }}" {{ $currentRole->id == $role->id ? 'selected="selected"' : '' }}>{{ $role->name }}</option>
113+
@else
114+
<option value="{{ $role->id }}">{{ $role->name }}</option>
115+
@endif
112116
@endforeach
113117
@endif
114118
</select>

0 commit comments

Comments
 (0)