just redirect, the same as you do in any other controller
Creating flash message engine
Hi guys again. In another topic you have adviced me about sending the e-mail. This thing works very good now, but I have a problem, when the e-mail is sent to address, I receive the blank page. I would like to redirect on "form" page, but show a flash message at the top of the page, How can I do that?
In my controller, there are two methods
- index(), which only show the form to fill
- report(), which will validate and authorize data and send an E-mail, based on "mailable" web template.
My report() function looks like this
public function report(ReportBug $request) {
$validatedData = $request->validated();
if($validatedData) {
Mail::to('[email protected]')->send(new BugReport($validatedData));
}
I suppose, the Mail::to... function should be in "if" condition and when true, I need to add some data to session, when false, I need to add another data to session. Then redirect to index() method with showing the flash message. How can I do that? Or is there the other engine to use?
Thank you
Please or to participate in this conversation.