More often than not you would need to perform some maintenance for your Laravel website.

Luckily Laravel makes it super easy to put your application in maintenance mode!

Enable default maintenance mode

In order to put your application in maintenance mode all that you need to do is to run the following artisan command:

php artisan down

Then after that if you visit your website in your browser you would a 503 page.

If you wanted to still be able to access your website, you could use a secret code:

php artisan down --secret="1630542a-246b-4b66-afa1-dd72a4c43515"

Then you could visit your website by adding the secret in your URL:

https://example.com/1630542a-246b-4b66-afa1-dd72a4c43515

Alternatively you could force a redirect to a specific page:

php artisan down --redirect=/

Create custom maintenance page

In order to change override the default 503 maintenance page, we need to add our own view at: resources/views/errors/503.blade.php.

<!DOCTYPE html>
<title>Site Maintenance</title>
<style>
    body { text-align: center; padding: 150px; }
    h1 { font-size: 50px; }
    body { font: 20px Helvetica, sans-serif; color: #333; }
    article { display: block; text-align: left; width: 650px; margin: 0 auto; }
    a { color: #dc8100; text-decoration: none; }
    a:hover { color: #333; text-decoration: none; }
</style>

<article>
    <h1>We’ll be back soon!</h1>
    <div>
        <p>Sorry for the inconvenience but we’re performing some maintenance at the moment. If you need to you can always <a href="mailto:#">contact us</a>, otherwise we’ll be back online shortly!</p>
        <p>— The Team</p>
    </div>
</article>

Of course, you can modify the page above to match your exact website design and needs!

Disable maintenance mode

In order to disable the maintenance mode of your website, you can just use the following artisan command:

php artisan up

This would disable the maintenance mode and your visitors would see your website as normal.