Authorization
Allow access to the preview outside the local environment.
The preview is open in the local and testing environments. Other environments require the viewMessagePreview gate, defined in a service provider:
php
use App\Models\User;
use Illuminate\Support\Facades\Gate;
Gate::define('viewMessagePreview', fn (User $user): bool => $user->is_admin);Requests denied by the gate receive a 403 response, guests included. Add auth to the middleware option to redirect guests to the login page instead.
The package must be installed in that environment, so require it without --dev.
Disable the preview
Set MESSAGE_PREVIEW_ENABLED to false. The preview routes then respond with 404 in every environment.