0

I need Help to Convert Mysql Query to Eloquent Laravel

 SELECT SUM((id_user=7) * `commission_agent`) AS sum7,SUM((id_user=8) * `commission_agent`) as sum8 FROM agents_commission
0

1 Answer 1

1

if you have the agents commission model set up correctly, you can use something like:

AgentCommission::select(DB::raw("SUM((id_user=7) *commission_agent) AS sum7,SUM((id_user=8) *commission_agent) as sum8"))->from(agents_commission)->get();

Sign up to request clarification or add additional context in comments.

1 Comment

@muhammad what problem are you having?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.