Duplicate column name being overwritten in Laravel Join
I have a query like this:
$users =
DB::table('users')->join('user_roles','users.role_id','=','user_roles.id')->get();
and a tables that has a column id (users.id) and another table that has
columns id and user_id (user_roles.id & user_roles.user_id),
but the problem is.. what is being returned on $user->id is the
user_roles.id instead of the users.id column.. how do i fix this so that
what i get is not the role id but the user id instead..
thanks!
No comments:
Post a Comment