php - How to return multiple custom values in model Laravel

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 $query->sum('price')*0.35;
}
This works, however I'd like to make this more simple. So instead of having to callOrder::profitplatform() and order::profitaffiliate, etc....
I wanted to call Order::profit() and it would return all those values to me all at once.
I tried to use Order::profitplatform()->profitaffiliate() but it doesn't work.
I was thinking of creating a specific service for this purpose however I don't think it's necessary. I think it's possible to with scopes or something else similar, however I'm not finding the solution.
I appreciate any suggestions, ideas and solutions for simplifying this problem. Thanks.
Answer
Solution:
try this:
Order::profitplatform()->profitaffiliate()->get();
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: unable to determine current zabbix database version: the table "dbversion" was not found.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.