how to make where in join table in laravel code example

Example 1: laravel join

Inner Join 	: ->join('contacts', 'users.id', '=', 'contacts.user_id')
Left Join 	: ->leftJoin('posts', 'users.id', '=', 'posts.user_id')
Right Join 	: ->rightJoin('posts', 'users.id', '=', 'posts.user_id')
Cross Join 	: ->crossJoin('colors')

Advance Queries : 
----------------- 
 		->join('contacts', function ($join) {
            $join->on('users.id', '=', 'contacts.user_id')
                 ->where('contacts.user_id', '>', 5);
        })

Example 2: laravel join 2 tables eloquent

$select->joinSub(
                    $selectSubQry,
                    'ag',
                    'ag.id',
                    '=',
                    'agp.userId'
                );

Tags:

Php Example