Код: Выделить всё
public function post_categories(): BelongsToMany
{
return $this->belongsToMany(PostCategory::class);
}
Код: Выделить всё
public function posts(): BelongsToMany
{
return $this->belongsToMany(Post::class);
}
Я пробовал разные вещи, но ничего не помогло.
Единственное, что сработало, это
Код: Выделить всё
$posts_1 = PostCategory::with('posts')->where('id', '=', '1')->first();
$posts_2 = PostCategory::with('posts')->where('id', '=', '2')->first();
$posts_3 = PostCategory::with('posts')->where('id', '=', '3')->first();
....
Буду очень признателен за любую помощь.
Спасибо!>
Подробнее здесь: https://stackoverflow.com/questions/798 ... ip-laravel
Мобильная версия