Answer the question
In order to leave comments, you need to log in
How is it possible and correct to add html with a controller in laravel?
Hello. Using the controller, I send the form to mail, after which the page reloads. Is it possible somehow to add html using a controller? I would like to notify the user when the form is submitted. I do not consider the option of redirecting to a separate page
Answer the question
In order to leave comments, you need to log in
controller:
public function handleForm(Request $request)
{
// dispatch(...); Тут отправляем Email
return back()->withSuccess('Письмо успешно отправлено!');
}
@include('includes.alerts')
@if (($isSuccess = isset($success)) || isset($error))
<div class="alert {{ $isSuccess ? 'alert-success' : 'alert-error' }} mb-3">
<p>{{ $success ?? $error }}</p>
</div>
@endif
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question