left join in laravel with models code example
Example 1: left join laravel
$users = DB::table('users')
->leftJoin('posts', 'users.id', '=', 'posts.user_id')
->get();
$users = DB::table('users')
->rightJoin('posts', 'users.id', '=', 'posts.user_id')
->get();
Example 2: laravel outer join
->join('answers as answers', 'responses.answer_id', '=', 'answers.id', 'left outer')