52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
||
|
||
namespace App\Http\Requests\Lead;
|
||
|
||
use App\Enums\LeadSource;
|
||
use Illuminate\Foundation\Http\FormRequest;
|
||
use Illuminate\Validation\Rule;
|
||
|
||
class StoreLeadRequest extends FormRequest
|
||
{
|
||
public function authorize(): bool
|
||
{
|
||
return true;
|
||
}
|
||
|
||
/**
|
||
* @return array<string, array<int, mixed>>
|
||
*/
|
||
public function rules(): array
|
||
{
|
||
return [
|
||
'name' => ['required', 'string', 'max:255'],
|
||
'phone' => ['required', 'string', 'max:20'],
|
||
'email' => ['nullable', 'email', 'max:255'],
|
||
'source' => ['required', 'string', Rule::enum(LeadSource::class)],
|
||
'target_course' => ['nullable', 'string', 'max:255'],
|
||
'education_level' => ['nullable', 'string', 'max:255'],
|
||
'subject' => ['nullable', 'string', 'max:255'],
|
||
'message' => ['nullable', 'string'],
|
||
'kvkk_consent' => ['required', 'accepted'],
|
||
'marketing_consent' => ['sometimes', 'boolean'],
|
||
'utm_source' => ['nullable', 'string', 'max:255'],
|
||
'utm_medium' => ['nullable', 'string', 'max:255'],
|
||
'utm_campaign' => ['nullable', 'string', 'max:255'],
|
||
];
|
||
}
|
||
|
||
/**
|
||
* @return array<string, string>
|
||
*/
|
||
public function messages(): array
|
||
{
|
||
return [
|
||
'name.required' => 'Ad Soyad zorunludur.',
|
||
'phone.required' => 'Telefon numarası zorunludur.',
|
||
'source.required' => 'Kaynak bilgisi zorunludur.',
|
||
'kvkk_consent.required' => 'KVKK onayı zorunludur.',
|
||
'kvkk_consent.accepted' => 'KVKK metnini onaylamanız gerekmektedir.',
|
||
];
|
||
}
|
||
}
|