Level 52
Try merge method :
$inputFile = ['name' => $filename];
$createTeamRequest->merge($inputFile);
Not sure it works because it's a file input.
Hi,
I'm actually having a issue with file uploads.
considering this function:
public function store(CreateTeamRequest $createTeamRequest)
{
if ($createTeamRequest->hasFile('avatar')){
$filename = $createTeamRequest->input("name").".avatar.".$createTeamRequest->file('avatar')->getClientOriginalExtension();
$createTeamRequest->file('avatar')->move(public_path()."/img/teams/", $filename);
}
dd($createTeamRequest->all());
$team = new Team();
$team->create($createTeamRequest->all());
Flash::success(Lang::get("forms.create_team_success", ["name" => $createTeamRequest->input("name")]));
return redirect("/teams");
}
How do i replace the value of the avatar field in my request so the new filename i gave to the file will be saved in db by the model?
Thanks for your help
Please or to participate in this conversation.