I have 3 tables:
Users - this table have the user data id, name, etc
Articles - this table have an article (id, title, content)
AdminArticle - this table define what articles can be manages by each user (id, user_id, article_id)
If the user 1 can edit the article 2 in the adminArticle table we will have:
user_id=1
article_id = 2
A user can manage multiple article and each article can be managed by multiple users.
Now on the articleController I want to list all the article (this is the default for index action), but I want to list only the article that the user can edit. How can I do it?
I have this dataProvider:
$dataProvider = new ActiveDataProvider([
'query' => Article::find(),
]);
How can i get only the article that the user can admin?