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

53 lines
1.9 KiB
PHP

<?php
namespace Modules\Testimonial\app\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateTestimonialRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'name' => 'required|string|max:255',
'designation' => 'sometimes|nullable',
'ordering' => 'required|integer|min:1',
'statement' => 'required|string',
'link' => 'sometimes|nullable|string',
'status' => 'required|in:active,inactive',
'image' => 'sometimes|nullable|image|mimes:jpeg,png,jpg,gif',
];
}
public function messages()
{
return [
'name.required' => 'The name field is required.',
'name.string' => 'The name field must be a string.',
'name.max' => 'The name may not be greater than 255 characters.',
'ordering.required' => 'The ordering field is required.',
'ordering.integer' => 'The ordering field must be an integer.',
'ordering.min' => 'The ordering field must be a positive number.',
'statement.required' => 'The statement field is required.',
'statement.string' => 'The statement field must be a string.',
'link.string' => 'The link field must be a string.',
'status.required' => 'The status field is required.',
'status.in' => 'The status field must be either "active" or "inactive".',
'image.image' => 'The image must be an image file.',
'image.mimes' => 'The image must be a file of type: jpeg, png, jpg, gif.',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
// return auth()->user()->can('users.create');
}
}