Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel advanced sub queries

use AppModelsDestination;
use AppModelsFlight;

return Destination::addSelect(['last_flight' => Flight::select('name')
    ->whereColumn('destination_id', 'destinations.id')
    ->orderByDesc('arrived_at')
    ->limit(1)
])->get();
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #Laravel #advanced #queries
ADD COMMENT
Topic
Name
7+3 =