You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I use FilterControl in Grid by relation of Eloquent model? For example:
I have DocumentActivity model assigned to User model. I can set $provider = new EloquentDataProvider(DocumentActivity::class); new FilterControl('user_id', FilterOperation::OPERATOR_LIKE, $input->option('user_id'))
but in this filter i can type only user_id, i want to filter by e.g user name.
How can i do that?
The text was updated successfully, but these errors were encountered:
Hi!
It's not possible becouse of Laravel architecture: relations are loaded in separate queries to DB.
So,
a) You can write a query with sql joins instead of using Laravel relations if you want to filter by related table fields (recommended solution)
b) You can preload all data and use it with ArrayDataProvider to filter by specific fileds, (it's not recommended solution due to potential performance issues) + looks like you will need to override filtering method inside FilterControl
How can I use FilterControl in Grid by relation of Eloquent model? For example:
I have
DocumentActivity
model assigned toUser
model. I can set$provider = new EloquentDataProvider(DocumentActivity::class);
new FilterControl('user_id', FilterOperation::OPERATOR_LIKE, $input->option('user_id'))
but in this filter i can type only user_id, i want to filter by e.g
user name
.How can i do that?
The text was updated successfully, but these errors were encountered: