class GenreStoreRequest extends FormRequest (View source)

Form request responsible for validating data when creating a new genre.

This request ensures that both the genre name and color code are unique and properly formatted before being persisted to the database.

Methods

bool
authorize()

Determine if the user is authorized to make this request.

array
rules()

Get the validation rules that apply to the request.

array
messages()

Get the custom messages for validation errors.

void
prepareForValidation()

Prepare the data for validation by sanitizing and normalizing inputs.

array
only(array|string $keys)

Retrieve only a subset of input data.

array
all(?array $keys = null)

Retrieve all input data or a subset.

bool
has(array|string $key)

Determine if the request contains a given input key.

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.

Details

bool authorize()

Determine if the user is authorized to make this request.

Return Value

bool

true if the user is authorized to perform this request

array rules()

Get the validation rules that apply to the request.

Return Value

array

validation rules for the incoming request data

array messages()

Get the custom messages for validation errors.

Return Value

array

custom validation messages

protected void prepareForValidation()

Prepare the data for validation by sanitizing and normalizing inputs.

This method trims the name field and converts the color hex code to uppercase while removing the leading "#" character if present.

Return Value

void

array only(array|string $keys)

Retrieve only a subset of input data.

Parameters

array|string $keys

Return Value

array

array all(?array $keys = null)

Retrieve all input data or a subset.

Parameters

?array $keys

Return Value

array

bool has(array|string $key)

Determine if the request contains a given input key.

Parameters

array|string $key

Return Value

bool

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