The error says assignedUsersisn't a valid property.. Try dumping the $ticket param out to see what is there. Is it an object, array or collection?
Jul 9, 2018
3
Level 1
Raw query relationship trouble on view
In our controller we want to do the following query:
$query = "SELECT * FROM posts WHERE ";
the rest of the query will be filled with what the user filles out.
In our view we are trying to display the names of users that are assigned to the post whitch looks like this.
@php $allAssigned = ""; @endphp
@if($ticket->assignedUsers->count() > 1)
@foreach($ticket->assignedUsers as $medewerker)
@php $allAssigned .= $medewerker->user->name . ", " @endphp
@endforeach($gebruikers as $medewerker)
@else
@foreach($ticket->assignedUsers as $medewerker)
@php $allAssigned = $medewerker->user->name @endphp
@endforeach($gebruikers as $medewerker)
@endif
This is the error we get:
Undefined property: stdClass::$assignedUsers (View: /home/vagrant/code/Ready4It-Ticket/resources/views/posts/index.blade.php)
I hope someone can help us out on our problem.
Greetings,
Zervan
Please or to participate in this conversation.