|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
|
|
|
|
|
|
use App\Models\SignupChannel;
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
|
|
|
|
|
|
class StoreSignupChannelRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return array<string, mixed>
|
|
|
|
|
*/
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'channel_code' => ['prohibited'],
|
|
|
|
|
'competition_id' => ['prohibited'],
|
|
|
|
|
'channel_name' => ['required', 'string', 'max:200'],
|
|
|
|
|
'status' => ['sometimes', Rule::in(SignupChannel::STATUSES)],
|
|
|
|
|
'shared_secret' => ['required', 'string', 'max:255'],
|
|
|
|
|
'entry_encryption_enabled' => ['sometimes', 'boolean'],
|
|
|
|
|
'success_callback_url' => ['nullable', 'url:http,https', 'max:2048'],
|
|
|
|
|
'success_callback_type' => ['sometimes', Rule::in(SignupChannel::CALLBACK_TYPES)],
|
|
|
|
|
'mini_program_callback_path' => [
|
|
|
|
|
'nullable',
|
|
|
|
|
'string',
|
|
|
|
|
'max:1024',
|
|
|
|
|
'regex:/^\/(?!\/)[^#]*$/',
|
|
|
|
|
'required_if:success_callback_type,'.SignupChannel::CALLBACK_TYPE_MINI_PROGRAM,
|
|
|
|
|
],
|
|
|
|
|
'mini_program_callback_method' => ['sometimes', Rule::in(SignupChannel::MINI_PROGRAM_METHODS)],
|
|
|
|
|
'remark' => ['nullable', 'string'],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|