feat: 增强玩家端 API 鉴权中间件,支持多语言错误消息返回
This commit is contained in:
@@ -26,5 +26,15 @@ class AppServiceProvider extends ServiceProvider
|
||||
/** @var Request $this */
|
||||
return $this->attributes->get('lottery_player');
|
||||
});
|
||||
|
||||
/**
|
||||
* 【当前请求语言】zh / en / ne,与 lottery.locales.supported 对齐。
|
||||
* 由 NegotiateLotteryLocale 写入 attribute;控制台等非 HTTP 或无该中间件时回落到 fallback。
|
||||
*/
|
||||
Request::macro('lotteryLocale', function (): string {
|
||||
/** @var Request $this */
|
||||
return (string) ($this->attributes->get('lottery_locale')
|
||||
?? config('lottery.locales.fallback', 'en'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user