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

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 :: PHP | get client ip simple 
Php :: how to add woocommerce cart counter 
Php :: form submitting twice 
Php :: php remove specific element from array 
Php :: how to add new column in laravel migration 
Php :: upppercase php 
Php :: push element at tart of arrray php 
Php :: wp_query post count 
Php :: integer nullable laravel 
Php :: php date fomat 
Php :: how to make a model in folder in laravel 
Php :: wordpress get user id by email 
Php :: flutter form autadjust height 
Php :: php odd or even 
Php :: auth guard api is not defined laravel 8 
Php :: get field acf 
Php :: php artisan route:list for specific name 
Php :: laravel nginx permissions 
Php :: get localstorage value in php 
Php :: php remove charictors from a string 
Php :: php bubble sort 
Php :: open php tag 
Php :: php object(stdclass) to array 
Php :: php carbon from timestamp 
Php :: laravel where update query 
Php :: toarray php 
Php :: php include and require statements 
Php :: wordpress remove add new button 
Php :: laravel file size validation 
Php :: increase memory laravel controller 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =