I would like to know how to change this query to something more OOP type.
select b.id, b.name,
(select ROUND(SUM(t.total),2) as total
from trip t where t.boat_id = b.id and year(t.check_out) = year(now()) group by boat_id) as total
from boat b;
Here is how I am building the query
$boat = Boat::query()->with('user');
Thanks in advance.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jqfxen
via IFTTT
Aucun commentaire:
Enregistrer un commentaire