How to put Laravel in maintenance mode


Did you know that you can put laravel on maintenance mode? this is another cool feature on laravel, you can put your application in maintenance mode temporarily and then you can put it back on again in no time.

To put laravel under maintenance mode, you can do it via command line, there is a dedicated artisan command for putting the application under maintenance mode and waking it up from maintenance. This feature has been around since laravel 4.2 and still exists in laravel 5. 

Artisan command to enable maintenance mode
php artisan down

Artisan command to disable maintenance mode
php artisan up

If you get permission error, then you need to run it with sudo command:
sudo php artisan down
sudo php artisan up

So what happened if we open the url of the application? under maintenance mode laravel will display message 'Be right back!', of course you can customize this message and put your own message there.


EmoticonEmoticon