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 :: laravel how to nested foreach 
Php :: how to install phpmyadmin on windows 10 
Php :: finding second highest number in array 
Php :: download file using jquery php 
Php :: how check the time of operation in laravel 
Php :: compare two datetime php 
Php :: laravel download file change name 
Php :: sha256 php cantidad caracteres 
Php :: fakestore api data in laravel 
Php :: laravel migration int length 
Php :: Regex to remove span tags using php [duplicate] 
Php :: php public folder 
Php :: get dates between two dates using specific interval using carbon 
Php :: in php how to check md5 password 
Php :: comment blade php 
Php :: wc php product_cat thumbnail 
Php :: unique string faker laravel 
Php :: wordpress how to display breadcrumb in child theme programmatically 
Php :: php set cookie for 5 second 
Php :: laravel firstorcreate usage 
Php :: codeigniter number format function 
Php :: recursive directory only listing php 
Php :: console_log in php 
Php :: laravel blade excerpt from body 
Php :: if post checked category wordpress 
Php :: arry to string php 
Php :: check url parameter if not redirect wordpress 
Php :: How to execute “php artisan migrate” and other Laravel commands in remote server? 
Php :: phpmyadmin mysql execution time 
Php :: php else 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =