我需要帮助将Mysql查询转换为Eloquent Laravel
SELECT SUM((id_user=7) * `commission_agent`) AS sum7,SUM((id_user=8) * `commission_agent`) as sum8 FROM agents_commission
答案 0 :(得分:1)
如果您正确设置了代理商佣金模型,则可以使用以下内容:
AgentCommission::select(DB::raw("SUM((id_user=7) *
{commission_agent {1}} {commission_agent {1}}