📜  Laravel 自定义缺失模型行为 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:45.105000             🧑  作者: Mango

代码示例1
use App\Http\Controllers\LocationsController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;

Route::get('/locations/{location:slug}', [LocationsController::class, 'show'])
        ->name('locations.view')
        ->missing(function (Request $request) {
            return Redirect::route('locations.index');
        });