Building a Professional Coming Soon Page with Laravel 13 and Filament v3
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 \…
This guide illustrates the implementation of a managed coming soon page using several components in a Laravel 13 application. The middleware, Filament settings, route, and Blade view are utilized to achieve this functionality.
The middleware, CheckComingSoonMode, is responsible for checking the application's mode. It first verifies if the 'settings' table exists in the database. If not, it passes the request through. If the request is from an admin or specific paths like 'admin/*', 'livewire/*', 'login', 'logout', 'system-setup-run', or 'api/*', it also passes the request through.
Next, it checks if the 'coming_soon_enabled' setting is enabled. If not, it allows the request to proceed. If the user is authenticated, the request is allowed to continue. If the user is a preview visitor, a session variable 'site_preview_bypass' is set to true. If the session variable 'site_preview_bypass' is already set to true, the request is passed through.
The application then retrieves all settings and their values, and returns a response displaying the 'coming-soon' view with the settings as variables. The response status is set to 503, which indicates a service unavailable.
In terms of administration, the toggle and fields for the settings are managed through the Filament System & Maintenance tab. The 'coming_soon_enabled' setting is a toggle that enables or disables the coming soon mode. The 'coming_soon_launch_date' setting is a datetime picker that allows the setting of the countdown timer for the live site. This setting is only visible when the 'coming_soon_enabled' setting is enabled.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to