Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel join with multiple conditions

$results = DB::table('rooms')
                     ->distinct()
                     ->leftJoin('bookings', function($join)
                         {
                             $join->on('rooms.id', '=', 'bookings.room_type_id');
                             $join->on('arrival','>=',DB::raw("'2012-05-01'"));
                             $join->on('arrival','<=',DB::raw("'2012-05-10'"));
                             $join->on('departure','>=',DB::raw("'2012-05-01'"));
                             $join->on('departure','<=',DB::raw("'2012-05-10'"));
                         })
                     ->where('bookings.room_type_id', '=', NULL)
                     ->get();
Comment

join multiple tables in laravel eloquent

$users = User::join('posts', 'posts.user_id', '=', 'users.id')
            ->where('users.status', 'active')
            ->where('posts.status','active')
            ->get(['users.*', 'posts.descrption']);
Comment

laravel eloquent multiple join with where conditions

$users = User::join('posts', 'posts.user_id', '=', 'users.id')
            ->where('users.status', 'active')
            ->where('posts.status','active')
            ->get(['users.*', 'posts.descrption']);
Comment

laravel eloquent multiple join

$users = User::join('posts', 'posts.user_id', '=', 'users.id')
              ->join('comments', 'comments.post_id', '=', 'posts.id')
              ->get(['users.*', 'posts.descrption']);
Comment

join multiple query in laravel

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

PREVIOUS NEXT
Code Example
Php :: replace string in php 
Php :: how to sort with array and after print by for loop in php 
Php :: how condition for multiple row by orwhere laravel 
Php :: create custom header in wordpress 
Php :: for each multiple php 
Php :: wp php category page count products 
Php :: php remove element from array by value 
Php :: php input time validation 
Php :: insert value in session in laravel 
Php :: delete data with ajax in php 
Php :: php clear post data 
Php :: get data from another table laravel 
Php :: php split string 
Php :: php number format without rounding 
Php :: windows logged in user name in php 
Php :: php array sort by key 
Php :: Codeigniter 3 Get future date recocords - upcoming records from database 
Php :: htaccess redirect https laravel 
Php :: php upload multiple files 
Php :: jquery send form data to php 
Php :: how to make a child theme in wordpress 
Php :: laravel inline if else if 
Php :: mysql Cannot pass parameter 2 by reference 
Php :: php combine 2 arrays keep duplicates 
Php :: wordpress get uploads images url 
Php :: php include once inside a function? 
Php :: wordpress add button to admin bar 
Php :: FPDF invoice Tutorial 
Php :: get data from csv file in php and print in table 
Php :: php flip array 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =