42 lines
1010 B
PHP
42 lines
1010 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Faq;
|
|
|
|
use App\Enums\FaqCategory;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StoreFaqRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<int, mixed>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'question' => ['required', 'string', 'max:500'],
|
|
'answer' => ['required', 'string'],
|
|
'category' => ['required', 'string', Rule::enum(FaqCategory::class)],
|
|
'order_index' => ['sometimes', 'integer', 'min:0'],
|
|
'is_active' => ['sometimes', 'boolean'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'question.required' => 'Soru zorunludur.',
|
|
'answer.required' => 'Cevap zorunludur.',
|
|
'category.required' => 'Kategori zorunludur.',
|
|
];
|
|
}
|
|
}
|