Accessing The Request: Request Path & Method

Request Path & Method

Accessing The Request: Request Path & Method — расположение

  • He Illuminate\Http\Request instance provides a variety of methods for examining the HTTP request for your application and extends the Symfony\Component\HttpFoundation\Request class.

Retrieving The Request Path

The is method allows you to verify that the incoming request path matches a given pattern.

$uri = $request->path();
If ($request->is('admin/*')) {
    //
}

The path method returns the request's path information.

Retrieving The Request URL

// Without Query String...
$url = $request->url();

// With Query String...
$url = $request->fullUrl();

To retrieve the full URL for the incoming request you may use the url or fullUrl methods.

Retrieving The Request Method

$method = $request->method();

if ($request->isMethod('post')) {
    //
}

The method method will return the HTTP verb for the request.

Accessing The Request: Request Path & Method — Structure map

Clickable & Draggable!

Accessing The Request: Request Path & Method — Related pages: