This Is Form Controller How can I redirect to Home Page after submission of form? or redirect to any url?
public function sendEmail(Request $request){
$this->validate($request, [
'fullname' => 'required',
'phonenumb' => 'required',
'mail' => 'required',
]);
Mail::send('email', [
'fullname' => $request->get('fullname'),
'phonenumb' => $request->get('phonenumb'),
'mail' => $request->get('mail') ],
function ($message) {
$message->from('[email protected]');
$message->to('[email protected]', 'Subject')
->subject('New candidate for Job ');
});
return back()->with('success', 'Thanks for contacting me, I will get back to you soon!');
}
}
CodePudding user response:
You can use route:
return redirect()->route('profile');
CodePudding user response:
Using the redirect
helper
redirect to route
return redirect()->route('home');
redirect to different url
return redirect('https://www.google.com/');
more about redirects in laravel