- 管理端账号/代理/站点等密码最短长度统一为 6 位 - LotterySettings、审计日志展示、币种与报表接口等小修复 - 补充设置批量更新、注单、校验错误等相关测试
34 lines
853 B
PHP
34 lines
853 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use Illuminate\Validation\Rule;
|
|
use App\Http\Requests\ApiFormRequest;
|
|
|
|
final class AdminCurrencyStoreRequest extends ApiFormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'code' => ['required', 'string', 'max:16', 'regex:/^[A-Z0-9]{1,16}$/', Rule::unique('currencies', 'code')],
|
|
'name' => ['required', 'string', 'max:64'],
|
|
'is_enabled' => ['sometimes', 'boolean'],
|
|
'is_bettable' => ['sometimes', 'boolean'],
|
|
];
|
|
}
|
|
|
|
protected function prepareForValidation(): void
|
|
{
|
|
if ($this->has('code')) {
|
|
$this->merge([
|
|
'code' => strtoupper(substr(trim((string) $this->input('code')), 0, 16)),
|
|
]);
|
|
}
|
|
}
|
|
}
|