本文整理汇总了PHP中Illuminate\Routing\Router::prepare方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::prepare方法的具体用法?PHP Router::prepare怎么用?PHP Router::prepare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::prepare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Execute the route and return the response.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return mixed
*/
public function run(Request $request)
{
$this->parsedParameters = null;
// We will only call the router callable if no "before" middlewares returned
// a response. If they do, we will consider that the response to requests
// so that the request "lifecycle" will be easily halted for filtering.
$response = $this->callBeforeFilters($request);
if (!isset($response)) {
$response = $this->callCallable();
} else {
$fromFilter = true;
}
$response = $this->router->prepare($response, $request);
// Once we have the "prepared" response, we will iterate through every after
// filter and call each of them with the request and the response so they
// can perform any final work that needs to be done after a route call.
if (!isset($fromFilter)) {
$this->callAfterFilters($request, $response);
}
return $response;
}
示例2: processResponse
/**
* Process a controller action response.
*
* @param \Illuminate\Routing\Router $router
* @param string $method
* @param mixed $response
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function processResponse($router, $method, $response)
{
$request = $router->getRequest();
// The after filters give the developers one last chance to do any last minute
// processing on the response. The response has already been converted to a
// full Response object and will also be handed off to the after filters.
$response = $router->prepare($response, $request);
$this->callAfterFilters($router, $method, $response);
return $response;
}