Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
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 :
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
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.
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.
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.