This guide shows exactly how to implement a managed coming soon page using the provided middleware, Filament settings, route, and Blade view.
Middleware: CheckComingSoonMode
<?php namespace App\Http\Middleware; use App\Models\Setting; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Schema; use Symfony\Component\HttpFoundation\Response; class CheckComingSoonMode { public function handle(Request $request, Closure $next): Response { if (!Schema::hasTable('settings')) { return $next($request); } if ( $request->is('admin') || $request->is('admin/*') || $request->is('livewire/*') || $request->is('livewire-*') || $request->is('login') || $request->is('logout') || $request->is('system-setup-run') || $request->is('api/*') ) { return $next($request); } $isComingSoonEnabled = filter_var( Setting::where('key', 'coming_soon_enabled')->value('value') ?? false, FILTER_VALIDATE_BOOLEAN ); if (!$isComingSoonEnabled) { return $next($request); } if (Auth::check()) { return $next($request); } if ($request->boolean('preview')) { $request->session()->put('site_preview_bypass', true); } if ($request->session()->get('site_preview_bypass', false)) { return $next($request); } $settings = Setting::all()->pluck('value', 'key')->toArray(); return response()->view('coming-soon', [ 'settings' => $settings, ], 503); } } Register the middleware in bootstrap/app.php:
$middleware->web(append: [ \App\Http\Middleware\CheckComingSoonMode::class, ]); Admin Control via Filament ManageSettings Page
The toggle and fields are placed inside the System & Maintenance tab of ManageSettings:
Forms\Components\Toggle::make('coming_soon_enabled') ->label('Enable Coming Soon Mode (Public Visitors)') ->helperText('When enabled, public visitors see the Coming Soon page. Logged-in admins and the header "Launch Website" button continue to view the live site.') ->default(false) ->live() ->columnSpanFull(), Forms\Components\DateTimePicker::make('coming_soon_launch_date') ->label('Launch Date & Time (Countdown Target)') ->seconds(false) ->native(false) ->helperText('Sets the live countdown timer displayed on the Coming Soon page.') ->visible(fn (Forms\Get $get): bool => (bool) $get('coming_soon_enabled')), Forms\Components\TextInput::make('coming_soon_title') ->label('Coming Soon Headline') ->placeholder('Something Delicious is Coming Soon') ->visible(fn (Forms\Get $get): bool => (bool) $get('coming_soon_enabled')), Forms\Components\Textarea::make('coming_soon_message') ->label('Coming Soon Message') ->rows(3) ->placeholder('We are putting the finishing touches on our new online dining experience. Stay tuned for our grand launch!') ->columnSpanFull() ->visible(fn (Forms\Get $get): bool => (bool) $get('coming_soon_enabled')), Saving writes directly to the settings table:
foreach ($this->form->getState() as $key => $value) { $stringValue = is_array($value) ? json_encode($value) : ($value ?? ''); Setting::updateOrCreate(['key' => $key], ['value' => $stringValue]); } Dedicated Coming Soon Route
Route::get('/coming-soon', function () { $settings = \Illuminate\Support\Facades\Schema::hasTable('settings') ? \App\Models\Setting::all()->pluck('value', 'key')->toArray() : []; return view('coming-soon', compact('settings')); })->name('coming-soon'); The Blade View (resources/views/coming-soon.blade.php)
@php $brandPrimary = $settings['brand_primary_color'] ?? '#ea580c'; $siteName = $settings['site_name'] ?? 'Our Restaurant'; $headline = !empty($settings['coming_soon_title']) ? $settings['coming_soon_title'] : 'Something Delicious is Coming Soon'; $message = !empty($settings['coming_soon_message']) ? $settings['coming_soon_message'] : 'We are putting the finishing touches on our new online dining experience. Stay tuned for our grand launch!'; $launchDate = !empty($settings['coming_soon_launch_date']) ? \Carbon\Carbon::parse($settings['coming_soon_launch_date'])->toIso8601String() : null; $logoUrl = !empty($settings['logo_image']) ? (\Illuminate\Support\Str::startsWith($settings['logo_image'], 'http') ? $settings['logo_image'] : asset('storage/' . $settings['logo_image'])) : null; @endphp The full Blade template includes the status badge, headline, message, four-column countdown grid driven by the ISO date in the data attribute, contact links, and footer. The inline JavaScript reads the target time and updates every second.
How the Enable/Disable Flow Works End-to-End
- Admin toggles
coming_soon_enabledto true inside the Filament System & Maintenance tab. - On the next request the middleware reads the value from the settings table.
- Non-authenticated, non-admin routes receive the 503 coming-soon view.
- Logged-in users and anyone with
?preview=1bypass via the session flag. - Disabling the toggle instantly restores normal site access.
Key Takeaways
- The entire coming soon experience is controlled by a single boolean in the settings table.
- Filament's ManageSettings page gives users full control without touching code.
- The middleware respects admin routes, Livewire, auth flows, and preview bypass.
- The Blade view dynamically renders branding, colors, logo, and countdown from the same settings.
What challenges have you faced when building coming soon pages? Share your experience in the comments below.
Follow for more Laravel and Filament tutorials.
