@PAPA - I think it's against single responsibility principles. You basically have Car class that does everything related to its childs rather than having childs to deal with their responsibilities.
I have seen that mostly in OS projects people use Refills::method($car->id) and then self::where(car_id, $carId)->get(); for such things. Since that is more logical place for such actions rather than cramming parent class.
what is best practice when you need to calculate custom collections in child model?
I have 2 Models-
Refill, Car has many Refills. I want to calculate average fuel consumption by month which basically creates new collection from refills entries, currently I have static class within Refill model that accepts car id as parameter, then does select query and iterates through results.
Is it possible to do something like
$car->refills()->getAverageMpgByMonth() instead of