- 将玩法相关的显示名称字段统一为 `display_name`,移除多语言字段。 - 在 `PlayTypePatchController` 中新增即时切换玩法开关的功能,并推送大厅更新。 - 优化多个控制器和服务中的权限检查与数据处理逻辑,提升代码可读性与维护性。
46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
final class DashboardAnalyticsRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/** @return array<string, mixed> */
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'period' => ['sometimes', 'string', Rule::in([
|
|
'today',
|
|
'last_7_days',
|
|
'last_30_days',
|
|
'this_month',
|
|
'lifetime',
|
|
'custom',
|
|
])],
|
|
'date_from' => ['nullable', 'date_format:Y-m-d', 'required_if:period,custom'],
|
|
'date_to' => ['nullable', 'date_format:Y-m-d', 'required_if:period,custom', 'after_or_equal:date_from'],
|
|
'metric' => ['sometimes', 'string', Rule::in(['overview', 'bet', 'payout', 'profit'])],
|
|
'play_code' => ['nullable', 'string', 'max:64'],
|
|
];
|
|
}
|
|
|
|
/** @return array<string, mixed> */
|
|
public function filters(): array
|
|
{
|
|
return [
|
|
'period' => (string) $this->input('period', 'last_7_days'),
|
|
'date_from' => $this->input('date_from'),
|
|
'date_to' => $this->input('date_to'),
|
|
'metric' => (string) $this->input('metric', 'overview'),
|
|
'play_code' => $this->input('play_code'),
|
|
];
|
|
}
|
|
}
|