本文整理匯總了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;
}