Okay, Here is the store method in my controller:
public function store(EmployeeRequest $request)
{
if($request->hasFile('photo')){
$path = $request->photo->store('employeeimages');
// This should have changed the element in the $request['photo'] index:
$request->photo = $path;
dd($request->all());
}
Employee::create($request->all());
return redirect('dashboard');
}
I thought $request->photo gives us the access to the $request['photo'] element of the array, so I tried to update it by $request->photo = $path; but when I die and dump $request->all(), $request['photo'] is not updated and still holds a reference to the previous value, which is an instance of the UploadedFile class. How do I change an element of the $request array?