user!
App\Post;
public function post()
{
return $this->belongsToMany(Post::class)
}
post!
use App\Comments;
use App\User;
public function Comments()
{
return $this->belongsToMany(Comments::class)
}
public function user()
{
return $this->belongsTo(User::class);
}
Relies!
public function post()
{
return $this->belongsTo(Post::class);
}
$post = Post::get()->first();
{{$post->body}}
{{$post->user->name}}
foreach($post->comments as $comment )
{
{{$comment->body}}
}