The website I'm working on is one continuous landing page with sections pulled in via blade pages and elements. How do I route a contact form in one of the landing page sections to a controller I've built?
I've built a controller that will send an email to my site administrator and also display a success notification to the user submitting the form. Right now, I've built the form on its own view ('example.com/contact'). Everything works appropriately when using the view. But I don't know how to get the landing page URL for the production contact form ('example.com/#contact') to route to the same (or any) controller.
@section('content')
@include('layouts.partials._header')
@include('pages.elements._about')
<div class="separator-line separator-primary"></div>
@include('pages.elements._calendar')
<div class="separator-line separator-primary"></div>
@include('pages.elements._contact') <!--form is pulled in here-->
@endsection
current web route that works with a separate view:
Route::get('/', function () {
return view('pages.landing');
});
Route::get('/contact', 'ContactController@show');
Route::post('/contact', 'ContactController@mailToAdmin');
Controller I'm trying to route the form to:
class ContactController extends Controller
{
public function mailToAdmin(ContactFormRequest $message, Admin $admin)
{
$admin->notify(new InboxMessage($message));
return redirect()->back()->with('message', 'Thanks for the message! We will get back to you soon!');
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire