Pickles Framework Documentation

Required
in package
implements ValidationRule

Class Required

This class implements the ValidationRule interface and provides a rule to validate that a specific field is required and contains a non-empty value.

Table of Contents

Interfaces

ValidationRule
Interface ValidationRule

Methods

message()  : string
Returns the validation error message.
validate()  : bool
Validates whether the specified field exists in the data array and is not empty.

Methods

message()

Returns the validation error message.

public message() : string
Tags
inheritDoc
Return values
string

The error message indicating the field must be a number.

validate()

Validates whether the specified field exists in the data array and is not empty.

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

True if the field exists and is not empty, false otherwise.


        
On this page

Search results