John Davidson

php - Laravel maintenance mode refresh and render parameter

0 comments
Message:


I am trying to put my application into maintenance mode via php artisan down.


php artisan down --refresh=5 works fine and my browser refreshes after 5 seconds


If I want to render a custom maintenance view with php artisan down --render="maintenance.index" it renders the view located in resources/views/maintenance/index.blade.php like I want it to do.


But when I am using both parameters like this


php artisan down --render="maintenance.index" --refresh=5

It just renders the custom view but is not refreshing after 5 seconds. I thought maybe it matters in which order I type in the parameters. But it doesn't work either way.


php artisan down --refresh=5 --render="maintenance.index"

Is there a possibility to put my app into maintenance mode, rendering a custom view and refreshing the page every 5 seconds without editing the default 503.blade.php file?



My Answer:
custom-view.blade.php, how can I set a refresh parameter for that custom view?

Unfortunately, the refresh parameter is not directly supported when using the --render option with php artisan down. However, you can achieve a similar effect by manually adding a meta tag for refreshing the page in your custom maintenance view.

Here's an example of how you can add a meta tag for refreshing the page after 5 seconds in your custom maintenance view (custom-view.blade.php):

html





Maintenance Mode


Site is currently under maintenance


Please check back later






In this example, the meta tag with http-equiv="refresh" will automatically refresh the page after 5 seconds. You can adjust the content attribute value to set the desired refresh interval in seconds.

Remember to save your custom maintenance view file and then run php artisan down --render=custom-view.blade.php to put your application into maintenance mode with the custom view.

Rate this post

4 of 5 based on 8078 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us