Answer the question
In order to leave comments, you need to log in
How to filter by parameters of another model in GridView?
There are two tables Posts (id, name, author_id) and Hashtags (id, hashtag, post_id). Since a post can have multiple hashtags, I store the hashtags of a post in a separate table. Made models through Gii. It is necessary to make it possible to filter posts by hashtag in the GridView in the Posts model view. How to implement?
Answer the question
In order to leave comments, you need to log in
I recommend to disassemble this article:
https://www.yiiframework.com/wiki/851/yii2-gridvie...
There is just an example with hasMany
B to catch up:
https://www.yiiframework.com/wiki/780/ drills-searc... (here are more examples, I think it will be interesting to finally understand the searchModel)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question