Access application in maintenance mode using a secret token in Laravel

In this tutorial, I will give you an example of How to Access the application in maintenance mode using a secret token in Laravel, So you can easily apply it with your laravel 8, and laravel 9 application.

First, what we’re doing here, This is the example :

laravel maintenance mode

Laravel maintenance mode allows IP

Bypassing Maintenance mode

Maintenance Mode in Laravel

Whenever Our website is live, Sometimes we want to update code and database and test new modules. so we do our application down in maintenance mode.

Our application is in maintenance mode, a custom view will be displayed for all requests into your application. This makes it easy to “disable” your application while it is updating or when you are performing maintenance. A maintenance mode check is included in the default middleware stack for your application.

If the application is in maintenance mode, will be thrown with a status code of 503.

Laravel maintenance mode Apply

php artisan down
php artisan down

Laravel maintenance mode allows IP

Generate Secret Key:-

When we complete our all tasks and we want to push code on a live server, we want to give access to a particular user to test then we can generate a secret code to access the live site on down mode time using a secret token.

generate a secret key in laravel
php artisan down --secret="12345"

When we completed our all tasks and we want to push code on a live server, we want to give access to a particular user to test then we generate a secret code to access the live site on down mode time using a secret token.

Using command we create a secret code and enter it after the live URL domain we put the secret code, then the user
able to access all URLs in our application in maintenance mode.

Bypass maintenance mode

After completing all testing and push code you can up your site :

php artisan up

We learned the “Access application in maintenance mode using a secret token in Laravel”, I hope this article will help you with your Laravel application Project.

Also Read:- JSON Encode and Decode in Laravel.

Hi, My name is Gaurav Pandey. I'm a Laravel developer, owner of 8Bityard. I live in Uttarakhand - India and I love to write tutorials and tips that can help other developers. I am a big fan of PHP, Javascript, JQuery, Laravel, WordPress. connect@8bityard.com

Scroll to Top