getRequest() public method

Returns the request component.
public getRequest ( ) : Request
return Request the request component.
Beispiel #1
0
 /**
  * Returns the log context for a web application
  * @return array
  */
 public function getWebContext(\yii\web\Application $app)
 {
     $request = $app->getRequest();
     $user = $app->getUser();
     return [['title' => 'Remote IP', 'value' => $request->getUserIP(), 'short' => true], ['title' => 'User ID', 'value' => $user->isGuest ? 'Guest' : $user->identity->getId(), 'short' => true], ['title' => 'URL', 'value' => $request->getUrl(), 'short' => true], ['title' => 'Method', 'value' => $request->method, 'short' => true]];
 }