tauseedzaman/laravel-coming-soon
Installation:
composer require tauseedzaman/laravel-coming-soon
php artisan vendor:publish --tag=coming-soon-config
php artisan migrate
config/coming-soon.php for core settings (e.g., enabled, title, description, launch_date).First Use Case:
config/coming-soon.php:
'enabled' => true,
'launch_date' => '2024-12-31', // Format: Y-m-d
Quick Customization:
php artisan vendor:publish --tag=coming-soon-views
resources/views/vendor/coming-soon/index.blade.php.Dynamic Launch Date Handling:
ComingSoon facade or service container to check if the coming-soon mode is active:
use Tauseedzaman\ComingSoon\Facades\ComingSoon;
if (ComingSoon::isActive()) {
// Show coming-soon page or redirect
}
ComingSoon::enable(); // or disable()
Route Protection:
RouteServiceProvider:
protected function mapWebRoutes()
{
$this->router->middleware(['coming.soon'])->group(function () {
// Routes to protect
});
}
auth: or custom middleware.Countdown Logic:
@php
$daysLeft = \Tauseedzaman\ComingSoon\Facades\ComingSoon::daysLeft();
@endphp
<p>Launching in {{ $daysLeft }} days!</p>
const daysLeft = @json($daysLeft);
// Update UI with setInterval()
Email/SMS Notifications (Advanced):
coming-soon.launch event (if supported) or manually trigger notifications when the launch date is reached:
if (ComingSoon::isLaunchDay()) {
Notification::route('mail', 'user@example.com')
->notify(new LaunchNotification());
}
$daysLeft via a Laravel Mix helper or Vite plugin.php artisan vendor:publish --tag=coming-soon-lang
Then edit resources/lang/en/coming-soon.php.X-Robots-Tag: noindex) when coming-soon mode is active:
public function handle($request, Closure $next)
{
if (ComingSoon::isActive()) {
$request->headers->set('X-Robots-Tag', 'noindex, nofollow');
}
return $next($request);
}
Middleware Order:
coming.soon middleware runs before other middleware (e.g., auth, guest) to avoid conflicts. Add it to $middlewarePriority in App\Http\Kernel.php:
protected $middlewarePriority = [
\Tauseedzaman\ComingSoon\Http\Middleware\ComingSoonMiddleware::class,
// Other middleware...
];
Database Migration:
coming_soon_settings table. If you customize the migration, do not delete the original table—it’s required for the package to function. Instead, extend it:
php artisan vendor:publish --tag=coming-soon-migrations
Then modify database/migrations/xxxx_create_coming_soon_settings_table.php.Launch Date Format:
launch_date in config/coming-soon.php must be in Y-m-d format. Invalid dates will silently disable the countdown logic.Caching:
launch_date or enabled config:
php artisan cache:clear
ComingSoon::cache() methods or config options.Route Caching:
php artisan route:clear
\Log::info('Coming Soon Active:', ['status' => ComingSoon::isActive()]);
\Log::info('Coming Soon Config:', config('coming-soon'));
// In App\Http\Kernel.php
protected $middleware = [
// Comment out: \Tauseedzaman\ComingSoon\Http\Middleware\ComingSoonMiddleware::class,
];
Custom Logic:
ComingSoonServiceProvider by publishing and extending it:
php artisan vendor:publish --tag=coming-soon-provider
register() or boot() methods in app/Providers/ComingSoonServiceProvider.php.API Endpoints:
Route::post('/admin/coming-soon', function () {
$enabled = request()->boolean('enabled');
config(['coming-soon.enabled' => $enabled]);
return response()->json(['status' => 'success']);
});
Frontend Customization:
@extends('vendor.coming-soon.index')
@section('extra_content')
<form action="/subscribe" method="POST">
<!-- Newsletter form -->
</form>
@endsection
Multi-Tenant Support:
coming_soon_settings table with a tenant_id column and querying accordingly:
use Tauseedzaman\ComingSoon\Models\ComingSoonSetting;
$settings = ComingSoonSetting::where('tenant_id', auth()->tenant()->id)->first();
How can I help you explore Laravel packages today?