Hello. I do not understand how to write a request (eloquent) correctly; I need to get news from all users to whom I am subscribed.
The table follows: id, from_id, to_id
Table users: id, username, email, etc ..
Table shots (news) id, user_id, title, category, etc ..
I just want to get it all in one request, because in Blade, I compare the total amount of news with the limit that I set - and if there is more news, I show the "download more" button, but, I don’t get anything, and I To be honest, I don’t understand what kind of connection I need to use. Help please, or poke into the documentation for the desired connection, I will dig it. thank
I tried this:
return $this->hasManyThrough('App\Shot','App\Follow','from_id','user_id');
But as I understood, eloquent does not understand that he needs to find posts with to_id == user_Id, but I do not understand how to tell him that, his brain is already boiling.