ScopeCurrentUser on add new item to table
Hello, I'm using the ScopeCurrentUser function, so the system only shows me my groups. But when creating a new post, I can create this post in another user's group. How can I fix this?
When I'm going to create a new post, I want to show only my groups in the relationship dropbox.
Hi there,
You will need to scope the relationship too. You can do that by following the steps from the docs here:
Besically you have to first add the local scope in the foreign model and then specify it in the relation, eg.:
{
"scope": "currentUser"
}
I've just tested it and can verify that it is working as expected.
Hope that this helps!
Best,
Bobby