I want to get data list , which has many relational rows in another table.
I need to check specific row of relational rows for getting data list from first, for example with it can be the first one and second … (some conditions), but in whereHas you know that we are checking all elements.
$shipments->whereHas('shipment_stops', function ($q) use ($startDate) {
$q->where('departure_date', '>=', $startDate) ;
});
This will check all shipment_stops, but I want to check only the last stop with the specific type (for example).
I know that maybe I can create better structure in DB, but anyway, I have this structure.
Thanks