Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

MethodDescriptionUsageReturns

get(string $var)

 


$var

Provide the HTTP request key

Returns the HTTP request value.

Code Block
languagephp
/**
 * URL Example: /foo?hello=1
 */
if (request()->get('hello')) {
   echo "Hello!";
}

HTTP request value on success, null on failure.

This supports all incoming HTTP
requests (e.g. GET, POST, DELETE etc...) 

isPost()

Checks to see if a form has been posted.

Code Block
languagephp
if (request()->isPost()) {

}

true on success, false on failure.

This method only checks POST requests.

segment(int $number)

 


$number

Provide the segment number
of the URL. 

Returns URL segment based on the
forward slash. 

 

Code Block
languagephp
/**
 * URL Example: /foo/bar
 */
echo request()->segment(1); // Prints foo
echo request()->segment(2); // Prints bar
Segment value on success, null on failure.