App::hasRequest

Usage

bool App::hasRequest(string $key)

Description

Checks whether or not the key exists within the request inputs.

Parameters

Parameter Required Type Description
$key Yes string The name of the variable to check whether or not it exists in the request.

Return Value

Boolean whether or not the variable exists within the request.

Examples

Check whether or not variable exists in request.



if (!$app->hasRequest('product_id')) { throw new Exception("No product ID specified."); }

See Also