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

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

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 :: php array order by date 
Php :: php inline if 
Php :: php while loop array 
Php :: check is array laravel 
Php :: php check if number starts with 0 
Php :: ci count 
Php :: how to remove additional sidebar in magento 2 using xml 
Php :: laravel on delete set null 
Php :: image watermark on image laravel 8 
Php :: image exists in laravel 
Php :: fixuphost 
Php :: concat in laravel 8 
Php :: create session in php 
Php :: php mongodb get all documents 
Php :: current loggedin user laravel 
Php :: php get random value from array 
Php :: insert php variable css 
Php :: swich in php 
Php :: disable block editor on widget section wordpress 
Php :: php date to seconds 
Php :: carbon to mysql datetime 
Php :: command to run php file on chrome 
Php :: laravel php artisan make:controller in subfolder 
Php :: laravel cmd command to watch logs 
Php :: case statement in php 
Php :: laravel first or create 
Php :: difference between fetch assoc and fetch array or object php 
Php :: php time difference in hours 
Php :: php number positive 
Php :: blade set variable 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =