Query #18
Answered
by
estudiobarragan
estudiobarragan
asked this question in
Q&A
-
First, thaks a lot for this wonderful package. Second, a problem. A have table users and post. The users bookmarks post and i need to shows all de post who a particular user bookmark. So, Post::where('state',5)->and here, how i cant know witch post are bookmars for this user? |
Beta Was this translation helpful? Give feedback.
Answered by
estudiobarragan
Jul 29, 2022
Replies: 1 comment 1 reply
-
I respond to my selfe (sorry...) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
riccardodallavia
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I respond to my selfe (sorry...)
$this->posts = Post::where('state_id', 5)
->with(['user', 'categoria', 'tags'])
->whereHasBookmark(auth()->user()) // this is the answer
->orderBy('publicar', 'desc')
->get();