feat: 添加 JWT 支持与开发环境配置,更新 API 路由与中间件
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Player;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
@@ -19,6 +21,10 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
// 仅在通过 EnsurePlayerApi 后可用;未走中间件时为 null
|
||||
Request::macro('lotteryPlayer', function (): ?Player {
|
||||
/** @var Request $this */
|
||||
return $this->attributes->get('lottery_player');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user