Skip to content

Request

kaythinks edited this page Apr 11, 2020 · 2 revisions

The Request class has different methods for accessing the global PHP varaiable $_REQUEST. They include the following


public static function all() : mixed

This method is for getting all data in the request object. It can be used like this e.g $request::all() , $request->all() or (new Request())::all(). NOTE :- The $request variable must be an instance of the Request object.


public function get(string $name) : string

This method is for getting a key value from the request object .It can be accessed like this $request->get('test').


public static function exists(string $name)

This method is for checking if a key value exists in the request object .It can be accessed like this $request::exists('test').


public static function isNull(string $name)

This method is for checking if a key value is null in the request object .It can be accessed like this $request::isNull('test').


public static function put(string $name, $input) : bool

This method is for putting a key value in the request object .It can be accessed like this $request::put('test','okay').


public static function push(array $input) : bool

This method is for putting an array in the request object .It can be accessed like this $request::push($arrayValue). NOTE:- This method deletes all previous values in the request object.


Clone this wiki locally