本文整理汇总了PHP中Illuminate\Routing\Router::prepareResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::prepareResponse方法的具体用法?PHP Router::prepareResponse怎么用?PHP Router::prepareResponse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::prepareResponse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callWithinStack
/**
* Call the given controller instance method.
*
* @param \Illuminate\Routing\Controller $instance
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
* @param string $method
* @return mixed
*/
protected function callWithinStack($instance, $route, $request, $method)
{
$middleware = $this->getMiddleware($instance, $method);
$shouldSkipMiddleware = $this->container->bound('middleware.disable') && $this->container->make('middleware.disable') === true;
return (new Pipeline($this->container))->send($request)->through($shouldSkipMiddleware ? [] : $middleware)->then(function ($request) use($instance, $route, $method) {
return $this->router->prepareResponse($request, $this->call($instance, $route, $method));
});
}
示例2: prepareResponse
/**
* Create a response instance from the given value.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param mixed $response
* @return \Illuminate\Http\Response
* @static
*/
public static function prepareResponse($request, $response)
{
return \Illuminate\Routing\Router::prepareResponse($request, $response);
}
示例3: prepareResponse
/**
* {@inheritDoc}
*/
protected function prepareResponse($request, $response)
{
$response = parent::prepareResponse($request, $response);
if ($this->requestTargettingApi($request)) {
if ($response instanceof IlluminateResponse) {
$response = ApiResponse::makeFromExisting($response);
}
if ($response->isSuccessful() && $this->getConditionalRequest()) {
if (!$response->headers->has('ETag')) {
$response->setEtag(md5($response->getContent()));
}
$response->isNotModified($request);
}
}
return $response;
}