Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Laravel join with 3 Tables

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 634
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: