What I'm trying to do is an affiliate program and I wish when I call an scope it returns all my desired values. There will be a logic for calculation of the values for the platform, seller and affiliate. What I have already is: public function scopeProfitPlatform($query) { return $query->sum('price')*0.6; } public function scopeProfitAffiliate($query) { return $query->sum('price')*0.05; } public function scopeProfitBuyer($query) { return...
Originally asked by hamon on Stack Exchange (stackoverflow) (CC BY-SA 4.0).