Answers for "Laravel advanced sub queries"

0

Laravel advanced sub queries

use App\Models\Destination;
use App\Models\Flight;

return Destination::addSelect(['last_flight' => Flight::select('name')
    ->whereColumn('destination_id', 'destinations.id')
    ->orderByDesc('arrived_at')
    ->limit(1)
])->get();
Posted by: Guest on July-24-2021

Browse Popular Code Answers by Language