Answer the question
In order to leave comments, you need to log in
How to make a notification about the execution of the POST method at the controller level?
Good afternoon, ladies and gentlemen.
There is a feedback form.
Which is processed in the controller.
I would like to make a notification about successful sending before the redirect.
public function postContact(Request $request) {
$this->validate($request, [
'email' => 'required|email',
'subject' => 'min:3',
'message' => 'min:10',
'infoaboutsender' => 'min:6']);
$data = array(
'email' => $request->email,
'subject' => $request->subject,
'bodyMessage' => $request->message,
'infoaboutsender' => $request->infoaboutsender
);
Mail::send('includes.contactemail', $data, function($message) use ($data){
$message->from($data['email']);
$message->to('[email protected]');
$message->subject($data['subject']);
});
Session::flash('success', 'Your Email was Sent!');
// Хочу реализовать тут
return redirect('/');
Answer the question
In order to leave comments, you need to log in
Well, at least there is: laracasts / flash
Which can be implemented once and for a long time, and then used in such cases:
Flash::success( 'Оплата прошла успешно.' );
return redirect( '' );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question