Requests

The requests class allows you to pull information from your API request, then do something with it.

Examples

Here are examples of how to use the request class.

//This is how you include the request class.
use SlenderApi\Lib\Request\Request;

//Add this to your class to gain access to the request object.
private Request $request;
public function __construct(object $controller)
{
    $this->request = $controller->request;
    $this->controller = $controller;
}

//This will give you all of the values in the post request.
$data = $this->request->getParameters();

//You can request single values from the post request.
$id = $this->request->getParameterValue('id');

//Get the user id of the user that is logged in.
$authenticatedUserId = $this->controller->request->getAuthenticatedUserId();

//You can use the map overrides method to override values for certain fields.
$parameters = $this->request->mapOverride($this->request->parameters, $userModel->columnOverrides());