# New Default Exception Page
11.9 重新設計了 error page,當 APP_DEBUG=true
時,會 render 以下 error page
而當 APP_DEBUG=false
時,則會 render 出以下 page
如果想要使用之前的 Ignition page,可以安裝 Laravel Ignition
composer require spatie/laravel-ignition
# Prevent Destructive Commands
11.9 新增 Prohibitable trait,它可以用來給 command 定義一個 property $isProhibitedFromRunning
,當這個 property 為 true 時,那就不可被執行
Laravel 預設已經將 Prohibitable trait 套用在一些 Facade,並且預設 prohibit 幾個 destructive commands,像是 db:wipe
,migrate:fresh
,migrate:refresh
,以及 migrate:reset
只要執行在 AppServiceProvider boot()
中執行 prohibitDestructiveCommands()
,就可以避免執行這些 commands
<?php
// Prohibits: db:wipe, migrate:fresh, migrate:refresh, and migrate:reset
DB::prohibitDestructiveCommands($this->app->isProduction());
自定義 command,只要有 use Prohibitable trait,也可以避免誤執行
<?php
public function boot(): void
{
YourCommand::prohibit($this->app->isProduction());
}
# Add withoutDelay() to the Queueable trait
11.9 新增一個 delay(0)
的 sugar syntax
當 dispatch job to queue 時,如果該 job 有 default delay time,可以使用 delay(0)
來取消這個 delay,現在也可以使用 withoutDelay()
<?php
dispatch((new MyJob($data))->delay(0));
dispatch((new MyJob($data))->withoutDelay());