Preload relations in BaseModel and global where #4255
Unanswered
vitortoigo
asked this question in
Help
Replies: 0 comments
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.
-
Hello,
I'm doing a tenancy based on a shared database, but i has some questions:
1 - Have a way to assign a
where
in the builder instace every time when a fetch is used (in any model)? Like in a middleware?2 - Has a easy way to preload relations in the model? (In laravel we have a public variable $with, just assign the relation names and in every query with the model, returns the relation);
My working code:
Basically, i extends this custom Model to anothers to use same methods.
Beta Was this translation helpful? Give feedback.
All reactions