ValidationRule
in
Interface ValidationRule
This interface defines the contract for validation rules in the application. Each validation rule must implement the message and validate methods.
Table of Contents
Methods
- message() : string
- Returns the validation error message.
- validate() : bool
- Validates the given field against the provided data.
Methods
message()
Returns the validation error message.
public
message() : string
Return values
string —The error message indicating the field must be a number.
validate()
Validates the given field against the provided data.
public
validate(string $field, array<string|int, mixed> $data) : bool
Parameters
- $field : string
-
The name of the field to validate.
- $data : array<string|int, mixed>
-
The data array containing the field and its value.
Return values
bool —Returns true if the validation passes, otherwise false.