老师,多对多关联这种写法,我好像没在文档中看到啊,你在哪里看的.
public function favoriteProducts()
{
return $this->belongsToMany(Product::class, 'user_favorite_products')
->withTimestamps()和
->orderBy('user_favorite_products.created_at', 'desc');
}
像这里的withTimestamps()和orderBy()链式调用的相关说明在文档哪里看的啊
推荐文章: