As we all know that when we are working on the big project then there is a need of join 2-3 table to get the result.
We can easily understand that by using example of joining 3 table.
Example:
$shares = DB::table('shares')
->join('users', 'users.id', '=', 'shares.userId')
->join('followers', 'followers.userId', '=', 'users.id')
->where('followers.followerId', '=', 3)
->get();
Here In the above example we can see that we are using 3 tables that are shares,users & followers and we are joining these table by using join keyword.
By this way we will join 3 Tables using Laravel 4.x
0 Comment(s)