anjanesh's avatar

Lead Generation via Landing Page System

Is there some composer package or some boilerplate code for using Laravel just for marketing purpose ? (No WordPress).

I want to use Laravel for a landing page for lead generation and have some sort of simple CRM platform as a dashboard for the leads generated via the Landing page.

One I've come across is krayincrm but how do I have to wire it to krayin or the likes ?

0 likes
4 replies
LaryAI's avatar
Level 58

To create a lead generation landing page with a simple CRM dashboard using Laravel, you can follow these steps:

  1. Set Up Laravel Project: First, create a new Laravel project if you haven't already:

    composer create-project --prefer-dist laravel/laravel lead-generation
    
  2. Create Landing Page: Create a controller and a view for your landing page. For example, you can create a LandingPageController:

    php artisan make:controller LandingPageController
    

    In 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');
    
  3. Create Lead Model and Migration: Create a model and migration for storing leads:

    php artisan make:model Lead -m
    

    In 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
    
  4. 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.

  5. 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.

martinbean's avatar
Level 80

@anjanesh Why do you need a package to create a landing page?

Just create the landing page, add a form. If you want that form to submit data to some CRM, then look if that CRM uses an API and send data via it if it does.

CapPerez's avatar

You can wire up a clean lead flow by firing Laravel events on form submit and pushing the payload straight into KrayinCRM through their REST API. I’ve reused the same pattern with small side tools like https://socialprofiler.com/ to enrich leads before storing them, which keeps things tidy without heavy packages. If you want a head start, Laravel Breeze plus a simple Contacts model usually does the trick.

anjanesh's avatar

I didn't venture after that - this was a requirement from a client which wasn't executed. I guess I'll have to explore sending data to a KrayinCRM webhook and see how it turns out. But I have not heard of Laravel Wave till now.

Please or to participate in this conversation.