Доброго дня)
Суть: Имеем несколько моделей:
# Recipe
class Recipe extends Model
{
public function tags()
{
return $this->belongsToMany('App\Models\Tag');
}
public function ingredients()
{
return $this->belongsToMany('App\Models\Ingredient')->withPivot('amount');
}
public function getRouteKeyName()
{
return 'slug';
}
}
# Tags
class Tag extends Model
{
protected $fillable = [
'name', 'slug', 'subsection_id', 'tag_type_id',
];
public function recipes()
{
return $this->belongsToMany('App\Models\Recipe');
}
}
...
Супер простой контроллер:
public function show(Recipe $recipe)
{
return view('pages/recipes/show', compact('recipe'));
}
В blade-шаблоне при переборе
@foreach($recipe->ingredients as $ingredients)
- всё работает отлично.
Но стоит мне добавить
@foreach($recipe->tags as $item)
- выпадает ошибка:

Если в контроллере вызвать
dd($recipe->tags)
- всё отлично.
Если в шаблоне написать
{{ var_dump($recipe->tags) }}
- всё показывает/работает.
В чём может быть проблема?