StudentUpdateRequest
class StudentUpdateRequest extends FormRequest (View source)
Handles validation for updating an existing student record.
Responsibilities:
- Validates updates to student data (e.g., name, CPF, email, phone, etc.).
- Ensures unique identifiers (CPF, email, phone) excluding the current student.
- Sanitizes and normalizes input before validation.
Security:
- Uses SHA-256 hashing for CPF, email, and phone to maintain privacy.
Methods
Determine if the user is authorized to make this request.
Define the validation rules for updating a student.
Get custom error messages for validation failures.
Prepare and normalize input data before validation.
Retrieve an input item from the request.
Merge new input into the request's data.
Retrieve a route parameter value.
Details
bool
authorize()
Determine if the user is authorized to make this request.
array
rules()
Define the validation rules for updating a student.
Applies conditional validation using "sometimes" to allow partial updates. Uniqueness checks for CPF, email, and phone exclude the current student's record.
array
messages()
Get custom error messages for validation failures.
protected void
prepareForValidation()
Prepare and normalize input data before validation.
- Removes non-numeric characters from CPF, phone, and period.
- Trims whitespace from all text fields.
- Ensures consistent formatting of user input.
mixed
input(string $key, mixed $default = null)
Retrieve an input item from the request.
void
merge(array $input)
Merge new input into the request's data.
mixed
route(string|null $key = null, mixed $default = null)
Retrieve a route parameter value.