Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shak's avatar
Level 2

Trying to get property 'id' of non-object

Guys can anyone help with this error. I'm using Spartie Permission.

            <select multiple name="roles[]">

                  <option value="" disabled>Assign Role</option>

                @foreach ($roles as $role )
                      <option value="{{$role->id}}" >{{($role->name)}}</option>
                @endforeach

            </select>


          </div>
0 likes
5 replies
shak's avatar
Level 2

Thank you but I was to solve the issue by installing laravelcollective/html,

shak's avatar
Level 2

Oh really, may I know why...? I'm still new to laravel, so I don't have enough experience using some of these packages

Please or to participate in this conversation.