The Query
$user_id = Auth::id();
$group_users = GroupUser::where('user_id', $user_id);
return view('groups.index', ['group_users' => $group_users]);
My Query has no errors
I need to list all rows from the group_users table with the the user ID that is equal to the
$user_id = Auth::id();
I am including the model with
use App\GroupUser;
And my table I am retrieving the data from has the following fields,
- group_id
- user_id
- user_role
And if I echo or print the
$user_id = Auth::id();
I get the correct user id. I'm not sure what I am missing.