[Adonis 4.1]Check if Relationship exists between two model #1484
Unanswered
tayfunakgc
asked this question in
Help
Replies: 1 comment
-
I think you can make use of https://adonisjs.com/docs/4.1/relationships#_wherehas
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have two models : User and Organization. There is many to many relationship between them.
Before showing an organization by id, I want to check the current user has the organization by id in a middleware.
In show method; I use 'findOrFail' to get organization (/orgs/:id, OrgController.show)
Before that I must to check the user has this organization. How can I achieve that?
Is there any method that returns bool if the current user has the organization?
Beta Was this translation helpful? Give feedback.
All reactions