希望你们今天都过得愉快。我正在一个博客页面上工作,并到达了一个部分,在那里我想要显示用户发布的特定博客。我向Post模型和用户模型添加了关系,但我似乎无法获得登录用户的特定帖子,它在标题中给出了上面的错误。这是我的模型和配置文件控制器。帖子模型{ public function user(){
return $this->belongsTo('App\User
在我的应用程序中,我首先检索产品类别和产品,现在我想从产品类别中提取产品,但我得到了以下错误: Property [products] does not exist on this collection instance. 这就是我首先获取类别,然后获取产品的方法 $productCategories = ProductCategory::with('products')->get(); //This works
$products = $productCategories->products; //Then this gives me error 以下是我的模
当我编辑产品时,我也尝试编辑多个图像,所以如果我上传新的图像,旧的图像应该被新的图像所取代,但是现在如果我上传图像,我得到了一个错误的Property [filename] does not exist on this collection instance.",旧的图像没有被删除,但是新的图像已经被添加了。有一些产品和ProductsPhoto表是相关的,在ProductsPhoto表中有一个文件名列和product_id列。在编辑产品时,如何用新的图像替换旧的图像?叶片模板
<input multiple="multiple" name=
hi我试图从索引页面获取与该类别相关的产品,但在产品列表页面显示错误, public function products(Request $request, Product $product) $categories = Category::distinct()->get(); } @foreach($categories->products as