Any company needs leads to increase sells and company growth. So it’s important to have the lead collecting form on your client website. In this article we will learn How to create professional lead collecting form for website. We will see how to develop an web page using PHP Laravel and Mysql to store all the leads in database. Previously i were developing this project for one of my client Luisnvaya. I created this form to collect customer enquiry as a lead and display in Admin area.
Lets see how to create an form.
Make Routes
Route::get('/contact-us', [App\Http\Controllers\ContactController::class, 'contactUs'])->name('contact_us');
Route::post('/lead-save', [App\Http\Controllers\Frontend\HomeController::class, 'LeadSave'])->name('lead_save');
Let’s make two routes one for leads collecting page and another for storing the leads. The first route contact-us for loading contact form and second route lead-save for storing the lead in database.
Create a Controller
So next step is to create a contoller named ContactController in app/Http/Controllers/ContactController . In Laravel controller is an PHP class that act as controlling system for an web application request-response cycle. It contains functions that handle lots of HTTP request. Developer can define custom number of function within a controller.
Here is an example your controller code should look like this.
Read Full Articles Here
Top comments (0)