Skip to content

[v5] How to use "whereHas" with preload #1628

Answered by remidosol
guntribam asked this question in Help
Discussion options

You must be logged in to vote

You can use afterFind and afterFetch hooks in your Model files. I resolve this problem like that. If you use these hooks, when you fetch a Model row, it always comes preloaded. Then you can filter them in Controller etc using query builder like have you done above.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@pk4all
Comment options

@guntribam
Comment options

Comment options

You must be logged in to vote
3 replies
@remidosol
Comment options

@pk4all
Comment options

@remidosol
Comment options

Answer selected by guntribam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants