1. Go to this page and download the library: Download kylerusby/laravel-waitlist library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kylerusby / laravel-waitlist example snippets
use KyleRusby\LaravelWaitlist\Models\Waitlist;
// Get all waitlist entries
$entries = Waitlist::all();
// Get recent entries
$recent = Waitlist::latest()->take(10)->get();
// Export emails
$emails = Waitlist::pluck('email')->toArray();
// Count total signups
$count = Waitlist::count();
// Generate URLs
route('waitlist.index') // GET /waitlist
route('waitlist.store') // POST /waitlist
// In Blade templates
<a href="{{ route('waitlist.index') }}">Join Waitlist</a>
// In redirects
return redirect()->route('waitlist.index');
use KyleRusby\LaravelWaitlist\Http\Controllers\WaitlistController;
Route::get('/join-us', [WaitlistController::class, 'index'])->name('waitlist.index');
Route::post('/join-us', [WaitlistController::class, 'store'])->name('waitlist.store');
// .env
WAITLIST_ENABLED=true
// Or in config/waitlist.php
'enabled' => env('WAITLIST_ENABLED', true),
'headline' => 'Be the First to Experience Something Amazing',
'subheadline' => 'Join our exclusive waitlist and get early access when we launch.',
'badge_text' => 'Limited Early Access',
'button_text' => 'Join Waitlist',
'success_message' => 'Thank you for joining! We\'ll be in touch soon.',
'member_count' => 1234, // Displayed as social proof
// Validation rules
'email' => [
'il',
]
// Custom error messages
'email.his email is already on the waitlist.'
return [
'enabled' => env('WAITLIST_ENABLED', true),
'routes' => [
'enabled' => true,
'prefix' => 'beta',
'middleware' => ['web', 'throttle:60,1'],
'paths' => [
'index' => '/signup',
'store' => '/signup',
],
],
'headline' => 'Join the Beta Program',
'subheadline' => 'Get exclusive early access to our new platform.',
'badge_text' => '🚀 Beta Access',
'button_text' => 'Get Early Access',
'success_message' => 'Welcome to the beta! Check your email for next steps.',
'member_count' => 500,
];
use KyleRusby\LaravelWaitlist\Rules\TurnstileRule;
// In a FormRequest
public function rules(): array
{
return [
'email' => ['
use Illuminate\Http\Request;
use KyleRusby\LaravelWaitlist\Rules\TurnstileRule;
Route::post('/waitlist', function (Request $request) {
$request->validate([
'email' => ['
// routes/web.php
use Illuminate\Http\Request;
use KyleRusby\LaravelWaitlist\Models\Waitlist;
Route::get('/waitlist', function () {
return view('my-custom-waitlist');
});
Route::post('/waitlist', function (Request $request) {
$request->validate([
'email' => '
namespace App\Models;
use KyleRusby\LaravelWaitlist\Models\Waitlist as BaseWaitlist;
class Waitlist extends BaseWaitlist
{
// Add custom scopes
public function scopeRecent($query, $days = 7)
{
return $query->where('created_at', '>=', now()->subDays($days));
}
// Add custom methods
public function notify()
{
// Send notification email
}
// Add custom attributes
public function getIsRecentAttribute(): bool
{
return $this->created_at->isToday();
}
}
// Using custom scope
$recentSignups = Waitlist::recent(30)->get();
// Using custom attribute
$entry = Waitlist::first();
if ($entry->is_recent) {
// Do something
}
// In a service provider (e.g., AppServiceProvider)
use KyleRusby\LaravelWaitlist\Models\Waitlist;
use Illuminate\Support\Facades\Mail;
public function boot()
{
Waitlist::created(function ($waitlist) {
Mail::to($waitlist->email)->send(new WelcomeToWaitlist($waitlist));
});
}
// app/Observers/WaitlistObserver.php
namespace App\Observers;
use KyleRusby\LaravelWaitlist\Models\Waitlist;
use Illuminate\Support\Facades\Mail;
use App\Mail\WelcomeToWaitlist;
class WaitlistObserver
{
public function created(Waitlist $waitlist): void
{
Mail::to($waitlist->email)->send(new WelcomeToWaitlist($waitlist));
}
}
// Register in AppServiceProvider
use App\Observers\WaitlistObserver;
public function boot()
{
Waitlist::observe(WaitlistObserver::class);
}
namespace App\Models;
use KyleRusby\LaravelWaitlist\Models\Waitlist as BaseWaitlist;
class Waitlist extends BaseWaitlist
{
protected $fillable = [
'email',
'name',
'company',
'reason',
];
}
namespace App\Http\Requests;
use KyleRusby\LaravelWaitlist\Http\Requests\StoreWaitlistRequest;
class CustomWaitlistRequest extends StoreWaitlistRequest
{
public function rules(): array
{
return array_merge(parent::rules(), [
'name' => '