I need help with collapse my collections. Its my code
public function showFriends(){
$request1 = DB::table('friends_users')
->join('users', 'users.id', '=', 'friends_users.user_id')
->where([['friend_id', '=',Auth::user()->id],['accepted', '=',true]])
->orWhere([['user_id','=',Auth::user()->id],['accepted','= ',true]])
->get();
$request2 = DB::table('friends_users')
->join('users', 'users.id', '=', 'friends_users.friend_id')
->where([['user_id','=',Auth::user()->id] , ['accepted','=',true]])
->get();
$all = collect($request1,$request2)->collapse();
return $all;
}
Problem is in $all variable because it return empty collection. Thank you for help.
via kacper1230