Eloquent ORM aggregation vs MySql aggregation
问题 I'm working on a Laravel 5.2 project and I'm using Eloquent models, but I'm not sure how to approach to aggregation features. Let's say I have Product and Price models and a hasMany relationship, so a product can have multiple prices. Now, in my Product model I'd like a function that will give me an average price of the product. I found 2 ways to get the same result: 1.) Eloquent aggregation public function avg_price() { return $this->prices()->avg('price'); } 2.) MySql aggregation public