Files
aroginhealthcare/Modules/FAQ/app/Http/Requests/CreateFaqRequest.php
2025-08-17 16:23:14 +05:45

52 lines
1.6 KiB
PHP

<?php
namespace Modules\FAQ\app\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateFaqRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'question' => 'required|string|max:1000',
'answer' => 'required|string|max:1000',
'ordering' => 'required|integer|min:1',
'status' => 'required|in:active,inactive',
];
}
public function messages()
{
return [
'question.required' => 'The question field is required.',
'question.string' => 'The question field must be a string.',
'question.max' => 'The question may not be greater than 1000 characters.',
'answer.required' => 'The answer field is required.',
'answer.string' => 'The answer field must be a string.',
'answer.max' => 'The answer may not be greater than 1000 characters.',
'ordering.required' => 'The ordering field is required.',
'ordering.integer' => 'The ordering field must be an integer.',
'ordering.min' => 'The ordering field must be at least 1.',
'status.required' => 'The status field is required.',
'status.in' => 'The status field must be either "active" or "inactive".',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
// return auth()->user()->can('users.create');
}
}