當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。