$users = DB::table('users')
->join('course', 'users.id', '=', 'course.courseId')
->join('skills', 'users.id', '=', 'skills.id')
->join('subjects', 'users.id', '=', 'subjects.id')
->get();
dd($users);
This gives me an empty result like this- items: []. I would like to join the 4 tables - users, course, skills & subjects and fetch all the data in all the 4 tables. users table has the id column(PK) named as id, course table has the id column(PK) named as courseId, skills table has its id column(PK) named as id & subjects table also has the id column(PK) named as id. The PK of all 4 tables is of the same data type biginteger. How to solve this?
leftJoininstead ofjoinor make sure you have data in all tables. Using relation would be easier if all you want is get all data (check answer)to perform a basic "inner join", you may use the join method. With inner join, if there is no row linked to one of the user in one of the other tables, the user will not be present in the result