Answer
If you need the 5 seconds at anytime for your custom maintenance view, simply add the refresh
html tag
<head>
<title>{{ config('app.name') }}</title>
<meta charset="utf-8">
<meta http-equiv="refresh" content="5">
</head>
On top of my head, I'm not sure what the refresh
attribute changes in laravel to apply this dynamically in your template, but I'll investigate this further a little bit later today.
Edit 1:
Laravel stores stub file for the maintenance mode but I could not find a result which affects the refresh
argument in combination with render
.
However I found a workaround to archive the same. The refresh
attribute is in the $_SERVER['argv']
environment variable, which can easily parsed and added to your blade view:
@php
$result = array_values(preg_grep('/(--refresh)/', array_values( $_SERVER['argv'] ) ));
if(!empty($result)){
$refresh = substr($result[0], strpos($result[0], "=") + 1);
}
@endphp
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ config('app.name') }}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
@if(isset($refresh))
<meta http-equiv="refresh" content="{{$refresh}}">
@endif
<!-- Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap">
<!-- Styles -->
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>
</head>
<body>
<!-- your content here... -->
</body>
</html>
Edit 2:
This issue is now fixed in Laravel PR [8.x] Fix refresh during down #42217
0 comments:
Post a Comment
Thanks