Maintenance mode in Laravel prevents users from accessing the application.
This is usually done when you want to carry out an update, upgrade, or debug errors from the application.
You can set your application to maintenance mode by running the following command:
php artisan down
Applications become inaccessible when they are in maintenance mode.
It is possible to bypass maintenance mode so that only you can access your application. To do this, you need to perform the following steps:
haruncpi/laravel-maintenancepackage using the
composer, as shown below:
composer require haruncpi/laravel-maintenance
app/Http/Kernel.phpfile, so that it resembles the following:
secretargument set to a key of your choice:
php artisan down --secret="mysecretkey"
Note: Ensure that the
mysecretkeyargument is a complex key for security reasons.
After following the entire process, your website is accessible to you alone.
To access your website, your link should resemble the following:
In the above link,
mysecretkey should be replaced by the argument you entered while running the
php artisan down --secret="mysecretkey" command.
Note: Remember this tutorial pertains to Laravel versions 6 and 7.
View all Courses