Files
bogazici-api/app/Http/Requests/Lead/StoreLeadRequest.php
2026-03-27 10:41:54 +03:00

52 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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.',
];
}
}