【发布时间】:2021-01-08 14:21:58
【问题描述】:
我在尝试更新数据时遇到此错误。如果我更新图像没有错误,但如果我没有显示调用成员函数 move() on null
这是我的代码:
public function update($id, Request $request)
{
$change = Profile::findorfail($id);
$before = $change->foto_profil;
$profile = [
'fullname' => $request['fullname'],
'phone' => $request['phone'],
'ttl' => $request['ttl'],
'foto_profil' => $before
];
$request->foto_profil->move(public_path().'/image', $before);
$change->update($profile);
return redirect('/profil');
}
【问题讨论】:
标签: laravel