I want to use for my form two submit buttons, the first one is to save and redirects you to the homepage and the second one is to save and redirects you to the same form again, I use public function store to save it, here is my form
<form method="post" action="{{route('return.store')}}" enctype="multipart/form-data">
<div class="form-group">
<button type="submit" class="btn btn-md" name="submit">Verstuur</button>
</div>
</form>
And my controller
public function store(Request $request)
{
$this->validate($request, [
'image' => 'image|nullable|max:1999'
]);
if ($request->hasFile('image')) {
$filenameWithExt = $request->file('image')->getClientOriginalExtension();
$filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
$extension = $request->file('image')->getClientOriginalExtension();
$fileNameToStore = $filename . '_' . Carbon::today()->toDateString() . '.' . $extension;
$request->file('image')->storeAs('public/images', $fileNameToStore);
} else {
$fileNameToStore = 'noimage.jpg';
}
$retour = new Retour();
$retour->firmaname = request('firmaname');
$retour->contactperson = request('contactperson');
$retour->email = request('email');
$retour->ordernumber = 653 .request('ordernumber');
$retour->articlenumber = request('articlenumber');
$retour->return_quantity = request('return_quantity');
$retour->return_quality = request('return_quality');
$retour->return_reason = request('return_reason');
$retour->images = $fileNameToStore;
$retour->save();
return redirect('/return')->with('message', 'Je retourmelding is succesvol verzonden');
}