TimiAde's avatar

Maintenance Mode in Laravel application

Can someone explain the maintenance mode to me. Cant understand it.

0 likes
3 replies
LaryAI's avatar
Level 58

Maintenance mode in Laravel allows you to put your application into a maintenance state, which displays a custom maintenance page to users while you perform updates or maintenance tasks on your application.

To enable maintenance mode in Laravel, you can use the down command. Open your terminal and navigate to your Laravel project directory. Then, run the following command:

php artisan down

This will put your application into maintenance mode. By default, Laravel will display a default maintenance page with a "Be right back" message.

If you want to customize the maintenance page, you can create a custom view file in the resources/views directory. For example, you can create a file called maintenance.blade.php and customize its content.

To bring your application out of maintenance mode, you can use the up command. Run the following command in your terminal:

php artisan up

This will disable maintenance mode and make your application accessible again.

You can also specify a message to be displayed on the maintenance page by passing the --message option to the down command. For example:

php artisan down --message="We'll be back soon!"

This will display the specified message on the maintenance page.

Note that when your application is in maintenance mode, only users with the maintenance mode bypass token can access the application. This token can be configured in the App\Http\Middleware\CheckForMaintenanceMode middleware.

I hope this helps! Let me know if you have any further questions.

ksorbo's avatar

@LaryAI There is no --message option for the down artisan command.

tisuchi's avatar
tisuchi
Best Answer
Level 70

@timiade Maintenance mode in Laravel is a feature that allows you to put your application into a temporary maintenance state. Enabling maintenance mode displays a customizable maintenance page to users, informing them that the site is currently undergoing maintenance and will be back shortly, while allowing you to perform necessary tasks without interruptions.

It is typically used during deployment or when performing updates.

Ref: https://laravel.com/docs/10.x/configuration#maintenance-mode

3 likes

Please or to participate in this conversation.