Is there a eloquent way to do a left join in Laravel?
We'd like to get all games and fill in the progress for each one if it exists in user_games.
Right now we've written the following solution, however this isn't eloquent at all, which we like it to be.
public function usergames($user_id) { return DB::table('games')->leftJoin('user_games', function ($join) use ($user_id) { $join->on('user_games.game_id', '=', 'games.id')->where('user_games.user_id', '=', $user_id); })->get(); }
Thanks in advance!