1 week ago

Displaying list of users that belongs to 1 particular event [Admin page]

Posted 1 week ago by mimiloca

I'm trying to display a list of user that belongs to 1 particular event in the admin page. This is many to many relationship. I'm trying to display the user name, and phone number inside the particular event page.

  1. I got error with Property [user] does not exist on this collection instance.

  2. How do I fix this to be able to view the list of user

  public function show()
        $events = Event::with('users')->get();
        return view('admin.event.user')->with('events', $events); 

 @foreach ($events->user as $user)
        <td>{{$loop->index +1 }}</td>

Please sign in or create an account to participate in this conversation.