Search
 
SCRIPT & CODE EXAMPLE
 

PHP

maintenance mode laravel

// turn on with bypass secret
php artisan down --secret="1630542a-246b-4b66-afa1-dd72a4c43515"
  
// turn off
php artisan up
Comment

maintenance mode laravel

# To enable maintenance mode:

php artisan down

# To disable maintenance mode:

php artisan up

# if you want client to refresh
# page after specified number of seconds

php artisan down --retry=60

# Even while in maintenance mode, you may use the secret option to specify a maintenance mode bypass token

php artisan down --secret="1630542a-246b-4b66-afa1-dd72a4c43515"

# Once you inform down command with secret provided as an argument you can hit following url to set cookie that will let you bypass maintenance mode on your browser using following url:

https://<your-site-name>/1630542a-246b-4b66-afa1-dd72a4c43515

# You can inform laravel to render specific view when running maintenance mode

{{view path: resources/views/maintenance.blade.php}}
php artisan down --render="maintenance"

# Sometime you may wish all your visitor not to access any of your webpages other than homepage during the maintenance mode. In that case you can redirect all of your web request to specified url


php artisan down --redirect=/

# If you want specific route to escape from maintenence mode you could add your route to 
app/http/middleware/CheckForMaintenanceMode.php

protected $except = [
        //here
];

# when you run artisan down. site is not available so when try to call up, your IP can't access site. you must call down with your IP exception.

php artisan down --allow=127.0.0.1 --allow=192.168.0.0/16
or add ::1 to local.

# In order to make your site live again using an url, you can create a live.php file which you put in laravel's public folder and then visit http://your.domain/live.php .
# In the live.php file you need something like this: (check your projects directory structure if you don't use the default public folder!)


unlink(dirname(__FILE__) . "/../storage/framework/down");
header("Location: your.domain"); 
die;

# If you would like the Refresh HTTP header to be sent with all maintenance mode responses

php artisan down --refresh=15

# Laravel allows you to pre-render a maintenance mode view that will be returned at the very beginning of the request cycle. This view is rendered before any of your application's dependencies have loaded

php artisan down --render="errors::503"
Comment

maintenance mode laravel

php artisan down
Comment

laravel maintenance mode custom class

<?php namespace AppHttpMiddleware;

use Closure;
use IlluminateContractsFoundationApplication;
use IlluminateHttpRequest;
use IlluminateFoundationHttpMiddlewareCheckForMaintenanceMode as MaintenanceMode;

class CheckForMaintenanceMode {

    protected $app;

    public function __construct(Application $app)
    {
        $this->app = $app;
    }

    public function handle(Request $request, Closure $next)
    {
        if ($this->app->isDownForMaintenance() && 
            !in_array($request->getClientIp(), ['8.8.8.8', '8.8.4.4']))
        {
            $maintenanceMode = new MaintenanceMode($this->app);
            return $maintenanceMode->handle($request, $next);
        }

        return $next($request);
    }

}
Comment

PREVIOUS NEXT
Code Example
Php :: php string search in array 
Php :: php array insert before key 
Php :: php get first day of month 
Php :: reset id auto increment after deleting a table row in phpmyadmin 
Php :: get file size in php 
Php :: How To Check If A String Ends With Another String In PHP 
Php :: php post variables to another page with submit button php 
Php :: How To Unset Or Delete An Element From Array By Value In PHP? 
Php :: how to install laravel 
Php :: move uploaded file in php 
Php :: post loop 
Php :: codeigniter base_url 
Php :: delete and return response and nocontent laravel 
Php :: replace string in php 
Php :: curl json post 
Php :: storepublicly laravel 
Php :: how to execute php function on button click 
Php :: how to set up the laravel ssh keygen 
Php :: substract two datetime and get the different hours and minutes php 
Php :: validation laravel 
Php :: How to add custom button in wordpress admin section 
Php :: php date list 
Php :: laravel Auth::logoutOtherDevices 
Php :: laravel model 
Php :: wp rest api acf fields 
Php :: start php cli 
Php :: livewire call function from other component 
Php :: get admin url wordpress 
Php :: php array_fill 
Php :: php script read source code web 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =