bo3bdo Blog

Back

Artisan down and maintenance page customisation in Laravel

Published 2 weeks ago 4 min read 418 comments 4 min read Laravel

Here we will see the maintenance mode and maintenance page customization in Laravel in details.

We often require maintenance to be done for our project. Laravel provides easy commands for the same.

Using “artisan down” we put our Laravel application on maintenance

After executing

php artisan down

Copy

When we run the application,we will get the following page by default provided by Laravel.

Host Laravel Application on DigitalOcean


Use coupon 5balloons on this Cloudways Affiliate URL to get special discount.

 

There are two ways of customizing the maintenance page.

1. Override 503 blade file

Create a directory named “errors” under resources/views and place a file named "503.blade.php" in it.

You can add the content of maintenance page in this resources/views/errors/503.blade.php like below :

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Maintenance Mode</title>
</head>
<body>
<div class="container"><div style="margin-top: 50px; text-align: center">
        We will be up in couple of minutes. Thanks for patience.</div>
</div>
</body>
</html>

Copy

So now after running artisan down , we will get the following page instead of default 503 error page.

 

2. Use custom blade file :

Using following command any blade file can be used as maintenance view file :

 php artisan down --render="filename"


Copy

For instance, you can create a blade view called filename.blade.php under resources/views directory with the following content.

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Maintenance Mode</title>
</head>
<body>
<div><p>Oops! We are wokring on it.</p><p>We will be back soon.</p>
</div>
</div>
</body>
</html>

Copy

The resulting maintenance mode view would like the following.

Using above description you can customize your maintenance page accordingly.