You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 KiB

<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreReviewerScopeRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'reviewer_id' => ['required', 'integer', 'exists:reviewers,id'],
'competition_id' => ['required', 'integer', 'exists:competitions,id'],
'track_code' => [
'required',
'string',
'max:64',
Rule::exists('competition_tracks', 'track_code')
->where('competition_id', $this->input('competition_id'))
->where('is_enabled', true),
Rule::unique('reviewer_scopes', 'track_code')
->where('reviewer_id', $this->input('reviewer_id'))
->where('competition_id', $this->input('competition_id')),
],
];
}
/**
* @return array<string, string>
*/
public function attributes(): array
{
return [
'track_code' => '赛道编码',
'reviewer_id' => '评审员',
'competition_id' => '赛事',
];
}
}