0
0
Laravelframework~10 mins

Maintenance mode in Laravel - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Maintenance mode
Start Laravel App
Check if Maintenance Mode is ON?
NoServe Normal Requests
Yes
Serve Maintenance Page
End Request
Laravel checks if maintenance mode is active before serving requests. If yes, it shows a maintenance page; otherwise, it serves the app normally.
Execution Sample
Laravel
php artisan down
// App now in maintenance mode
// Requests show maintenance page
php artisan up
// App back to normal mode
This code puts the Laravel app into maintenance mode and then brings it back to normal.
Execution Table
StepActionMaintenance Mode StatusRequest HandlingOutput
1Run 'php artisan down'ONCheck mode -> Maintenance ONMaintenance page shown
2User sends requestONServe maintenance pageUser sees maintenance message
3Run 'php artisan up'OFFCheck mode -> Maintenance OFFNormal app serves requests
4User sends requestOFFServe normal appUser sees normal app content
5EndOFFNo maintenanceNormal operation
💡 Maintenance mode OFF, app serves normal requests
Variable Tracker
VariableStartAfter Step 1After Step 3Final
maintenance_modeOFFONOFFOFF
Key Moments - 3 Insights
Why does the app show a maintenance page after running 'php artisan down'?
Because the maintenance_mode variable changes to ON at Step 1, so Laravel serves the maintenance page as shown in Step 2.
What happens if you try to access the app while maintenance mode is ON?
The app serves the maintenance page instead of normal content, as seen in Step 2 of the execution table.
How do you bring the app back to normal operation?
By running 'php artisan up' which sets maintenance_mode to OFF at Step 3, allowing normal requests to be served.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the maintenance_mode status after running 'php artisan down'?
AUNKNOWN
BOFF
CON
DERROR
💡 Hint
Check Step 1 in the execution_table under 'Maintenance Mode Status'
At which step does the app start serving normal requests again?
AStep 2
BStep 4
CStep 3
DStep 1
💡 Hint
Look at 'Request Handling' and 'Output' columns in execution_table rows
If you skip running 'php artisan up', what will users see when they send requests?
AMaintenance page
BError 404
CNormal app content
DBlank page
💡 Hint
Refer to Step 2 where maintenance_mode is ON and maintenance page is served
Concept Snapshot
Laravel Maintenance Mode:
- Run 'php artisan down' to enable maintenance mode.
- While ON, users see a maintenance page.
- Run 'php artisan up' to disable and return to normal.
- Laravel checks mode on each request.
- Useful for safe app updates.
Full Transcript
Laravel maintenance mode lets you temporarily disable your app for users by running 'php artisan down'. When enabled, Laravel shows a maintenance page instead of normal content. This is useful during updates or fixes. To return to normal, run 'php artisan up'. The app checks the maintenance mode status on every request and serves content accordingly.