嗨,我在尝试更新邮递员中的图片时遇到错误
我的控制器
$validator = Validator::make($request->all(), [
'category_id'=> 'required',
'product_name'=> 'required',
'product_description'=> 'required',
'product_img'=> 'required'
] );
if ($validator -> fails()) {
return $this->sendError('error validation', $validator->errors());
}
$product = Product::findOrFail($id) ;
$product->category_id = $request->input('category_id');
$product->subcat_id = $request->input('subcat_id');
$product->product_name = $request->input('product_name');
$product->product_description = $request->input('product_description');
$product->product_properties = $request->input('product_properties');
$product->product_img = $request->file('product_img')->store('images');
$product->product_pdf = $request->file('product_pdf')->store('files');
if($product->update()){
return $this->sendResponse($product->toArray() , 'Product Updated Succesfully');
}
我的PostMan行
"product_img":"Downloads/screencapture-file-C-Users-gkpro-Desktop-ui-Semantic-UI-master-examples-navbar-html-2019-01-03-20_31_47.png"
我收到此错误
在null上调用成员函数store()