Search
 
SCRIPT & CODE EXAMPLE
 

PHP

merge two query results in laravel

$teamStanding = Ladder::getTeamPosition($request->competitionId, $request->id)->get();

$teamStatistics = TeamCompetitionStatistics::getTeamStats($request->competitionId, $request->id)->get();

$merged = $teamStatistics->merge($teamStanding);

$result = $merged->all();

// return [{'teamstanding': 'data', 'teamstatictics': 'data'}]
Comment

laravel merge two query builder

$page = Page::select('id as page_id','name_en as page_name');
        $data['permissions'] = Permission::where('role_id', $id)->joinSub($page,'permissions_page',function($join){
            $join->on('permissions.page_id','=','permissions_page.page_id');
        })->get();
Comment

PREVIOUS NEXT
Code Example
Php :: grouping routes based on controller laravel 
Php :: update profile method in laravel 
Php :: php implode 
Php :: php ?? 
Php :: laravel update all relations 
Php :: laravel validation double 
Php :: eloquent get record older than 2 days 
Php :: laravel drop table migration 
Php :: how laravel return the old value 
Php :: php sodium extension xampp 
Php :: create migration with model laravel 
Php :: php function uppercase first letter 
Php :: check if host is local in php 
Php :: laravel url download file 
Php :: laravel mail send 
Php :: date hour php 
Php :: php get screen size 
Php :: get last element of array php 
Php :: how to merge 2 laravel eloquent records 
Php :: php artisanmigrate 
Php :: qr code generator php 
Php :: write string variable in php 
Php :: today date to ago for the date in php 
Php :: gettype() function in PHP 
Php :: php exec get pid 
Php :: apache using wrong php version 
Php :: laravel trans with parameters 
Php :: include blade file in laravel 
Php :: Create a table with PHP in html 
Php :: Creating Laravel and Vue Project 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =