Methods 对字符串调用成员函数扩展()对字符串调用成员函数save()
调用字符串上的成员函数扩展() 错误如何解决 公共函数更新(请求$Request,ProductImage$ProductImage) {Methods 对字符串调用成员函数扩展()对字符串调用成员函数save(),methods,Methods,调用字符串上的成员函数扩展() 错误如何解决 公共函数更新(请求$Request,ProductImage$ProductImage) { $slug = Str::slug($request->image_title,'-'); // if($request->image) // { if($request->image) { $image=time().'.'.$request-&
$slug = Str::slug($request->image_title,'-');
// if($request->image)
// {
if($request->image)
{
$image=time().'.'.$request->image->extension();
$request->image->move(public_path('images'),$image);
}
else
{
$image=$productImage->image;
}
$productImage->update([
'product_id'=>$request->product_id,
'image_title'=>$request->image_title,
'image'=>$image,
'slug'=>$slug
]);
return redirect()->route('productimage.index');
}