Search
 
SCRIPT & CODE EXAMPLE
 

PHP

join 2 tables laravel

use IlluminateSupportFacadesDB;

$users = DB::table('users')
            ->join('contacts', 'users.id', '=', 'contacts.user_id')
            ->join('orders', 'users.id', '=', 'orders.user_id')
            ->select('users.*', 'contacts.phone', 'orders.price')
            ->get();
Comment

how to join two tables in laravel

use IlluminateSupportFacadesDB;
//in the following example we will join two tables
//a products table and categories table
$categoryProducts = Product::join('categories', 'categories.id', '=', 'products.category_id')
        ->select('products.*', 'categories.category_name')
        ->where('products.status', 1)
        ->get();
Comment

laravel join 2 tables eloquent

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

PREVIOUS NEXT
Code Example
Php :: how validate the value of object in arraye in laravel 
Php :: laravel httaccess for apache 
Php :: php round up 
Php :: wp post featured image not showing admin 
Php :: laravel tree category 
Php :: php force array keys trim 
Php :: wp get_posts return ids 
Php :: filter_var filter_validate_url 
Php :: clear console php 
Php :: convert time to 24 hour format laravel 
Php :: php date set utc hours 
Php :: update many laravel 
Php :: unique array 
Php :: getting input value in session variable in php 
Php :: insert data using seeder in laravel 
Php :: wherejsoncontains laravel 
Php :: how to create laravel project 
Php :: php read text file into array 
Php :: php array sum 
Php :: laravel eloquent search json column 
Php :: how to serve the port in php 
Php :: file_put_contents 
Php :: laravel wire not working 
Php :: laravel collection isempty 
Php :: laravel datepicker date format 
Php :: how to add share icon in wordpress 
Php :: guzzlehttp/guzzle version with laravel-websockek 
Php :: php match 
Php :: password change logout from wordpress 
Php :: laravel use variable inside callback function 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =