A collection of programming & webdesign
Laravel maintenance mode

While working on a live Laravel project it might be useful to set the page in a maintenance mode, so that users visiting it, won't see any errors while work's in progress.

For this, practically just log into the server where your project is located, navigate to your project folder and there use the command  php artisan down . This sets your application in a maintenance mode. What people visiting your page then will see is a standard Laravel maintenance page.

If you want to personalize this page, go to your project, resources, views and open a directory called “errors”. Within this directory you create a file called 503.blade.php . You can then add your personal style and structure to the page. As long as it's there, Laravel will use this one instead of the default one.

To set your system live again, just use the terminal you used to set it to maintenance mode and use the command  php artisan up .

One additional, very helpful thing:

While setting your project to maintenance mode you can still access it, if you set a so-called “secret”:

  • instead of using  php artisan down , use  php artisan down --secret="mySecretCode" 
  • after it your project will still be in maintenance mode, so users visiting https://yourproject.com will see the maintenance message, but you can still access your live project using the secret, like so:

Please note, that the secret is probably saved by your browser in the cache. So, if you want to check your live system in the end again, better use another browser, an incognito window or clear the cache before reloading.