【发布时间】:2017-01-13 08:52:56
【问题描述】:
我正在尝试插入图像表,但以下语法显示方法保存不退出:Macroable.php 第 74 行中的 BadMethodCallException:。
控制器:
foreach ($request->file('image') as $i)
{
$image = new image();
$image = $i;
$input['imagename'] = $request->vname.'_'.$user->id.'_'.str_random(2).'.'.$image->getClientOriginalExtension();
$destinationPath = public_path('/images');
//move image to folder
$image->move($destinationPath, $input['imagename']);
$image->title=$input['imagename'];
$image->filepath=$destinationPath;
$image->Vehicle_id=$vehicles->id;
$image->save();
}
谁能告诉我我做错了什么?
【问题讨论】:
-
请添加完整的方法(包括参数)
-
保存不存在:Macroable.php 第 74 行中的 BadMethodCallException
-
我认为这一行,你分配了 $image = $i;
-
codeshare.io/a3kjga 完整代码。 @弗兰克教务长
-
尝试 $image->move('paht/to/image/image.jpg') 而不是保存