Hello, someone could help me with an eloquent query.
User::with(['post','Y aun tengo más relaciones. ..'])
->where('nick',$nick)->first();
This way I get the information of a user X and I see the posts.
but I need only show the last 5 post he did. I could use OrderBy and take
But I need to know The total amount of post that user has. could use Count()
I could do it by doing a different query, but I know there's a better way to do it.
I could do it like that. . but there are many consultations, because it is not only that. There are more things that I need to do.
Post::where('IDUSER',auth()->user()->id)->take(5)->get();
And I know that maybe there is a better way to do it, by the end I will send it to a component vue