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

bool
authorize()

Determine if the user is authorized to make this request.

array
rules()

Define the validation rules for updating a student.

array
messages()

Get custom error messages for validation failures.

void
prepareForValidation()

Prepare and normalize input data before validation.

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.

Details

bool authorize()

Determine if the user is authorized to make this request.

Return Value

bool

true if the request is authorized

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.

Return Value

array

validation rules

array messages()

Get custom error messages for validation failures.

Return Value

array

custom validation messages

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.

Return Value

void

mixed input(string $key, mixed $default = null)

Retrieve an input item from the request.

Parameters

string $key
mixed $default

Return Value

mixed

void merge(array $input)

Merge new input into the request's data.

Parameters

array $input

Return Value

void

mixed route(string|null $key = null, mixed $default = null)

Retrieve a route parameter value.

Parameters

string|null $key
mixed $default

Return Value

mixed