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

55 lines
1.8 KiB
PHP

<?php
namespace Modules\TeamMember\app\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateTeamMemberRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'name' => 'required|string|max:255|regex:/^[a-zA-Z. ]+$/',
'group_id' => 'required|integer|min:1',
'designation' => 'required|string|max:255',
'detail' => 'sometimes|nullable|string',
// 'group-a' => 'array',
'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.',
'name.regex' => 'The name field only accepts letters, spaces, and dots.',
'group_id.required' => 'The group ID field is required.',
'group_id.integer' => 'The group ID must be an integer.',
'group_id.min' => 'The group ID must be at least 1.',
'designation.required' => 'The designation field is required.',
'designation.string' => 'The designation field must be a string.',
'designation.max' => 'The designation may not be greater than 255 characters.',
'detail.string' => 'The detail field must be a string.',
'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;
}
}