更新时间:2023-02-22 14:45:39
Sync是构建器实例上的一种方法,您正在集合中使用它.
Sync is a method on the builder instance, you're using it on the collection.
// change your code like this
$post->tags()->sync($request->tags);
$post->categories()->sync($request->categories);