Answers for "laravel join table with itself"

PHP
4

join 2 tables laravel

use Illuminate\Support\Facades\DB;

$users = DB::table('users')
            ->join('contacts', 'users.id', '=', 'contacts.user_id')
            ->join('orders', 'users.id', '=', 'orders.user_id')
            ->select('users.*', 'contacts.phone', 'orders.price')
            ->get();
Posted by: Guest on December-09-2020
1

laravel outer join

->join('answers as answers', 'responses.answer_id', '=', 'answers.id', 'left outer')
Posted by: Guest on June-05-2020
0

laravel joins

// example 1
User::joinRelationship('posts');

// example 2
User::joinRelationship('posts.comments');
Posted by: Guest on August-31-2021

Browse Popular Code Answers by Language