by($request->user()?->id ?: $request->ip()); }); $this->routes(function () { Route::middleware('api') ->prefix('api') ->group(base_path('routes/api.php')); /** 选手端附件预览:不走 web session,避免长连接预览占用 session 锁 */ Route::get('/participant/application-files/{file}', [\App\Http\Controllers\Api\ApplicationFileController::class, 'downloadSigned']) ->middleware('signed') ->whereNumber('file') ->name('participant.application-file.download'); Route::middleware('web') ->group(base_path('routes/web.php')); }); } }