I need to attain latest comments from array of users through posts.
Users model
public function comments()
{
return $this->hasManyThrough('App\Comment', 'App\Post');
}
has-many-through
$user = users::where('id',5)->first();
$user->comments()->get()
many has-many-through
$user = users::where('role','member')->get();
How can I achieve this.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire