Level 75
You said update. So how did you originally upload the file successfully.
If just updating, you unlink old and just update with new, like you did when originally creating (adding) it.
Hi Guys,
I am trying to solve an issue that I am facing with updating file's path in my database. The file was uploaded to the right directory but I was unable to store that path in my database. Can anyone help with it, provided below is my scripts.
public function update($id, UpdateinfrastructureRequest $request)
{
$infrastructure = $this->infrastructureRepository->find($id);
if (empty($infrastructure)) {
Flash::error('Infrastructure not found');
return redirect(route('infrastructures.index'));
}
$path = Storage::putFile('storage', $request->file('inf_file'));
$request['inf_file'] = $path;
$infrastructure = $this->infrastructureRepository->update($request->all(), $id);
Flash::success('Infrastructure updated successfully.');
Thanks.
Please or to participate in this conversation.