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 eloquent queries

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

PREVIOUS NEXT
Code Example
Php :: how pass optional route parameter in laravel 
Php :: Undefined index: name laravel 
Php :: php override built in functions 
Php :: what is actullay work model in laravel 
Php :: a non well formed numeric value encountered laravel 
Php :: create trait in laravel 8 
Php :: auto logout when session expires laravel 
Php :: php html text before first h2 tag 
Php :: readable var dump php 
Php :: data XML 
Php :: $e = array("red", "green", "blue"); echo intval($e) . "<br"; 
Php :: asas 
Php :: php glob multiple file with different formats in directory 
Php :: yii2 rollback last migration 
Php :: Problem getting updated value from child component to the parent component in a Laravel 9 with Vue 
Php :: php to display variables 
Php :: undefined offset: 7 in d:xamphtdocsphpfunctionfunction.php on line 137 
Php :: discord.py Levels 
Php :: Check box group submit (php) 
Php :: php csv to multirow array $_FILES 
Php :: php?gs=3 
Php :: php limit results by 30 days 
Php :: Check php and wordpress version before activation 
Php :: php executor 
Php :: if no data show msg and chang style laravel 
Php :: print average result in php 
Php :: PHP vsprintf — Return a formatted string 
Php :: opencart set page title config php 
Php :: can i do a relation between 2 coulnm in mongodb laravel 
Php :: phpmyadmin arch 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =