Home Documentation GitHub Support

Retrieving data

In order to retrieve a request data from a controller or middleware, there are two main properties that can be used:

  • $this->get - Parameters passed to the request through the GET method.
  • $this->post - Parameters passed to the request through the POST method.
  • $this->params - Parameters passed in dynamic URLs (see Routes).

All properties return an Element with the corresponding data.

Example 1
view

<form method="post" action="send">
    <input type="text" name="user" value="glowie">
    <input type="password" name="password" value="123">
    <button type="submit">Login</button>
</form>

controller

public function send(){
    $user = $this->post->user; # returns "glowie"
    $password = $this->post->password; # returns "123"
}

Example 2

# user types in myappurl.com/search?query=products&page=1
$query = $this->get->query; # returns "products"
$page = $this->get->page; # returns "1"

You can also use the methods from Request instance to retrieve request data.