Hi there
I have two tables: Subscriptions and Partners.
How can I use Eloquent to multiply two fields from differente tables?
Subscription::with('partner')
->select('partner_id', DB::raw('SUM(amount)* <Partner Commission> AS total'))
->groupBy('partner_id')
->orderBy('total','desc')
->get();
How can I access the Commission fields from the Partner table?
if your column was called commission on the partner table just use table name . column
eg: partner.commission_column
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community