【发布时间】:2020-08-18 12:42:59
【问题描述】:
我想在帖子视图中显示 category_title。我正在为 category_id 和 post_id 使用数据透视
帖子模型:
public function categories()
{
return $this->belongsToMany(Category::class,'category_post','post_id','category_id');
}
Show.blade.php
{{$post->categories->category_title}}
但是告诉我这个错误
此集合实例上不存在属性 [category_title]。
【问题讨论】: