widget query filter on related field
I followed the instructions and have a summarizing widget table for Campaign Status.
It has filters on the Dashboard: Client and Service Manager.
It filters fine on client_id, a field in the campaign table.
Dashboard:
The other filter returns the correct id to the widget because I can log the values in the widget.
But I don't understand how to filter by related data.
Campaign BelongsTo a Client, a Client BelongsTo a Customer Support Manager
Here is my Widget table
Error:
Solution:Jump to solution
Yeah,
customSupportManager()
is very likely not a column in your DB. You can't use Laravel relation on a DB directly.
$query->where('customerSupportManager()', $csm_id); // belongsToThrough
I guess you need some left join leftJoin()
to get the needed columns...3 Replies
bump
bump?
Solution
Yeah,
customSupportManager()
is very likely not a column in your DB. You can't use Laravel relation on a DB directly.
$query->where('customerSupportManager()', $csm_id); // belongsToThrough
I guess you need some left join leftJoin()
to get the needed columnsCorrect, not a column in database but a relationship on the Campaign Model. I'll try a leftJoin.