To create a lead generation landing page with a simple CRM dashboard using Laravel, you can follow these steps:
-
Set Up Laravel Project: First, create a new Laravel project if you haven't already:
composer create-project --prefer-dist laravel/laravel lead-generation -
Create Landing Page: Create a controller and a view for your landing page. For example, you can create a
LandingPageController:php artisan make:controller LandingPageControllerIn
LandingPageController.php:<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\Lead; class LandingPageController extends Controller { public function show() { return view('landing'); } public function store(Request $request) { $request->validate([ 'name' => 'required|string|max:255', 'email' => 'required|email|max:255', ]); Lead::create($request->all()); return redirect()->back()->with('success', 'Thank you for your interest!'); } }Create a view file
resources/views/landing.blade.php:<!DOCTYPE html> <html> <head> <title>Landing Page</title> </head> <body> @if(session('success')) <p>{{ session('success') }}</p> @endif <form action="{{ route('landing.store') }}" method="POST"> @csrf <input type="text" name="name" placeholder="Your Name" required> <input type="email" name="email" placeholder="Your Email" required> <button type="submit">Submit</button> </form> </body> </html>Define routes in
routes/web.php:use App\Http\Controllers\LandingPageController; Route::get('/', [LandingPageController::class, 'show'])->name('landing.show'); Route::post('/', [LandingPageController::class, 'store'])->name('landing.store'); -
Create Lead Model and Migration: Create a model and migration for storing leads:
php artisan make:model Lead -mIn the migration file
database/migrations/xxxx_xx_xx_create_leads_table.php:<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateLeadsTable extends Migration { public function up() { Schema::create('leads', function (Blueprint $table) { $table->id(); $table->string('name'); $table->string('email'); $table->timestamps(); }); } public function down() { Schema::dropIfExists('leads'); } }Run the migration:
php artisan migrate -
Integrate Krayin CRM: Krayin CRM is a Laravel-based CRM system. You can integrate it into your Laravel project by following their installation guide. Here’s a brief overview:
-
Install Krayin CRM via Composer:
composer create-project krayin/laravel-crm -
Follow the setup instructions provided in the Krayin CRM documentation.
-
-
Wire Up Leads to Krayin CRM: You can create a custom integration to sync leads from your Laravel application to Krayin CRM. This might involve creating an API endpoint in Krayin CRM to accept leads and then sending the leads from your Laravel application to this endpoint.
Example of sending lead data to Krayin CRM:
use Illuminate\Support\Facades\Http; public function store(Request $request) { $request->validate([ 'name' => 'required|string|max:255', 'email' => 'required|email|max:255', ]); Lead::create($request->all()); // Send lead data to Krayin CRM Http::post('https://your-krayin-crm-url/api/leads', [ 'name' => $request->name, 'email' => $request->email, ]); return redirect()->back()->with('success', 'Thank you for your interest!'); }
By following these steps, you can set up a lead generation landing page with a simple CRM dashboard using Laravel and Krayin CRM.