I have three models User, Post and Comment
User
-id
Post
-user_id
Comment
-post_id
My table has issues, for example, some posts are not there or some user rows are not there.
How can I be able to get only comments that have a post_id which exists and it also has a user_id of the user which exists using a scope most preferably global scope?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire