当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::pjax方法代码示例

本文整理汇总了PHP中Illuminate\Http\Request::pjax方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::pjax方法的具体用法?PHP Request::pjax怎么用?PHP Request::pjax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Http\Request的用法示例。


在下文中一共展示了Request::pjax方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildFailedValidationResponse

 /**
  * Create the response for when a request fails validation.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  array  $errors
  * @return \Illuminate\Http\Response
  */
 protected function buildFailedValidationResponse(Request $request, array $errors)
 {
     if ($request->ajax() && !$request->pjax() || $request->wantsJson()) {
         return new JsonResponse($errors, 422);
     }
     return redirect()->to($this->getRedirectUrl())->withInput($request->input())->withErrors($errors, $this->errorBag());
 }
开发者ID:TheJohnzo,项目名称:make-a-choice,代码行数:14,代码来源:ValidatesRequests.php

示例2: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Exception               $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($request->ajax() && !$request->pjax()) {
         //            return response([
         //                'status' => 'error',
         //                'message' => $e->getMessage()
         //            ], 500);
     }
     return parent::render($request, $e);
 }
开发者ID:projnoah,项目名称:noah,代码行数:17,代码来源:Handler.php

示例3: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Exception $e
  *
  * @return \Illuminate\Http\Response
  */
 public function render($request, \Exception $e)
 {
     if ($request->ajax() && !$request->pjax() || $request->wantsJson()) {
         return $this->sendResponseForApiException($e);
     }
     if (is_backend()) {
         if ($e instanceof ModelNotFoundException) {
             return $this->sendResponseForModelNotFound($e);
         }
         if ($e instanceof ValidationException) {
             return $this->sendResponseForValidationError($request, $e);
         }
         return $this->renderControllerException($e);
     }
     return parent::render($request, $e);
 }
开发者ID:KodiComponents,项目名称:module-core,代码行数:24,代码来源:Handler.php

示例4: handel

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  Closure                  $next
  *
  * @return mixed
  */
 public function handel($request, Closure $next)
 {
     if (!$request->pjax()) {
         return $next($request);
     }
     // First we get the request fragment, then we compile it to view cache
     // next time we can request the cached view instead of manipulate complex
     // string from response.
     // 覆写 view factory
     // 检查是否有已存的模版
     // 检查是否过期
     // (编译模版
     // 取出一种的代码段另存)-》 如果不能直接取代码段-》 crawler dom 或 pjax
     // 执行并返回
     return $next($request);
 }
开发者ID:abrahamgreyson,项目名称:elektra,代码行数:24,代码来源:Middleware.php

示例5: pjax

 /**
  * Determine if the request is the result of an PJAX call.
  *
  * @return bool 
  * @static 
  */
 public static function pjax()
 {
     return \Illuminate\Http\Request::pjax();
 }
开发者ID:satriashp,项目名称:tour,代码行数:10,代码来源:_ide_helper.php

示例6: buildSucessedResponse

 /**
  * Create the response for when a request successed.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 protected function buildSucessedResponse(Request $request)
 {
     if ($request->ajax() && !$request->pjax() || $request->wantsJson()) {
         return new JsonResponse(['success' => 1], 200);
     }
     return redirect()->intended($this->getRequest()->get('redirect') ?: '/');
 }
开发者ID:telenok,项目名称:account,代码行数:13,代码来源:ValidatesRequests.php

示例7: guessRequestType

 /**
  * @param \Illuminate\Http\Request $request
  * @return string
  */
 public function guessRequestType(Request $request)
 {
     $userAgent = strtolower($request->header('User-Agent'));
     $contentType = array_get($request->getAcceptableContentTypes(), 0);
     if (strpos($userAgent, 'googlebot') !== false) {
         return 'googlebot';
     } elseif ($request->ajax()) {
         return 'ajax';
     } elseif ($request->pjax()) {
         return 'pjax';
     } elseif ($contentType === null) {
         return 'raw';
     } elseif (Str::contains($contentType, ['application/rss+xml', 'application/rdf+xml', 'application/atom+xml'])) {
         return 'feed';
     } elseif ($request->wantsJson() || Str::contains($contentType, ['application/xml', 'text/xml'])) {
         return 'api';
     } elseif (!$request->acceptsHtml()) {
         return 'other';
     } elseif (Auth::check()) {
         return 'user';
     }
     return 'public';
 }
开发者ID:exolnet,项目名称:laravel-instruments,代码行数:27,代码来源:Instruments.php

示例8: buildFailedValidationResponse

 /**
  * Create the response for when a request fails validation.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  array  $errors
  * @return \Illuminate\Http\Response
  */
 protected function buildFailedValidationResponse(Request $request, array $errors)
 {
     if ($request->ajax() && !$request->pjax() || $request->wantsJson()) {
         return new JsonResponse($errors, 422);
     }
     if ($request->ajax()) {
         zbase()->json()->setVariable('_redirect', app(UrlGenerator::class)->previous());
     } else {
         return redirect()->to($this->getRedirectUrl())->withInput($request->input())->withErrors($errors, $this->errorBag());
     }
 }
开发者ID:claremontdesign,项目名称:zbase,代码行数:18,代码来源:Controller.php

示例9: convertValidationExceptionToResponse

 /**
  * Create a response object from the given validation exception.
  *
  * @param  \Illuminate\Validation\ValidationException  $e
  * @param  \Illuminate\Http\Request  $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function convertValidationExceptionToResponse(ValidationException $e, $request)
 {
     if ($e->response) {
         return $e->response;
     }
     $errors = $e->validator->errors()->getMessages();
     if ($request->ajax() && !$request->pjax() || $request->wantsJson()) {
         return response()->json($errors, 422);
     }
     return redirect()->back()->withInput($request->input())->withErrors($errors);
 }
开发者ID:mark86092,项目名称:laravel-framework,代码行数:18,代码来源:Handler.php


注:本文中的Illuminate\Http\Request::pjax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。