Laravel display a custom message in Maintenance Mode

If you want detailed information (not just message) on your maintenance page, you can also use $exception->retryAfter(Int), $e->willBeAvailableAt(Carbon) and $e->wentDownAt(Carbon). Of course you need to set --retry parameter in artisan command.


Actually you don't need that "json_decode" stuff, as all the "error" views (including 503.blade.php) have $exception variable.

So you may just use {{ $exception->getMessage() }} in your view and you will get the exact value that you have passed to artisan down --message command.


By default 503.blade.php view doesn't use this message.

This message is available in a JSON formatted file named storage/framework/down generated by php artisan down command.

You could do something like this to access the directly the message in your view:

{{ json_decode(file_get_contents(storage_path('framework/down')), true)['message'] }}

A cleaner way is to use the $exception variable and include in your view {{ $exception->getMessage() }} like suggested in this answer.

Under the hood, the CheckForMaintanceMode middleware reads the message and other data from the file and thrown a MaintanceModeException with this data.

Edit: After Laravel 8, the payload that creates the storage/framework/down command has changed and doesn't include the exception message. You should use the {{ $exception->getMessage() }} instead on Laravel 8+.