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"
get env app url laravel
env('APP_URL')
laravel APP_ENV config
if (\Illuminate\Support\Facades\App::environment('production')) {
    // The environment is production
}
Source: laravel.com
laravel maintenance mode custom class
<?php namespace App\Http\Middleware;

use Closure;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Http\Request;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode 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);
    }

}

PHP相关代码片段

symfony entity target entity

php two spase remove

mailtrap laravel

php check if var is datetime

bulk taxonomy addition wordpress php

install laravel 10

php datetime format milliseconds

PRAGMA foreign_keys

PHP function to sanitize input prevent XSS

curl php get

php array to stdclass

php curl get parameters array

curl php no response

fpdf allow special characters

stripe payment in php

php filter associative array

Laravel 11 - Production assets issue

php get const properties of a class

http_build_query bearer token

Why do Sessions disappear on refresh? - Laravel

hooks in codeigniter

hard delete laravel

how to view the data in json

laravel pagination with relationship

custom pagination laravel

laravel add new command provider

Laravel Request validation Multiple column Unique

php artisan publish stub

old and edit value laravel blade

how to var_dump in php

how to change php version in ubuntu

temporary change php version to 7.4 ubuntu

terminal in php

get all the variables defined in a php file

is csrf token fixed for a laravel website?

php new datetime

Print loop data in a sigle cell in laravel excel

array to string laravel

joomla get custom fields

time ago function

woocommerce get product by title

what differene insert save and create in laravel

Custom error auth massage laravel

convert letters to numbers php

convert number to letter php

php url rewrite

tcpdf table page break border bottom

laravel View path not found.

php how to check if datetime is valid

php curl and https

ping website is working php

scoped query laravel

php get fractional part of float

laravel scope filter relationship

laravel return empty 200 response

php version required for laravel 11

@selected blade directive

nested back buttons laravel site:stackoverflow.com

Laravel API Resources

set laragon terminal in vscode

pingdom plugin for php

php doc block

php doc block array object

laravel network run

Save dataimage format to save laravel

Illuminate\Queue\MaxAttemptsExceededException

php array print

laravel upi validation

convert int array to string array laravel

get client extension php

vscode default editor in env file laravel

if number in array return true laravel 10

laravel append attribute to model

Change woocommerce Add to Cart text and link

php version alternate

craet or first laravle

session_start() No such file or directory

Account Activity Log with php mysql

codeigniter 4 send email safely from user inputs

Clear queue and horizon laravel