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


PHP Redirector::back方法代码示例

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


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

示例1: failedResponse

 /**
  * @param  string $middleware
  * @param  bool   $isAjax
  * @return \Illuminate\Http\RedirectResponse
  */
 protected function failedResponse($middleware, $isAjax = false)
 {
     if ($isAjax) {
         return $this->response->make($this->getErrorMessage($middleware), 403);
     }
     return $this->redirector->back()->exceptInput('_guard_pot', '_guard_opened')->withErrors($this->getErrorMessage($middleware));
 }
开发者ID:ryanwinchester,项目名称:laravel-spamguard,代码行数:12,代码来源:Middleware.php

示例2: store

 /**
  * Store the scope
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store()
 {
     $validator = $this->validationFactory->make($this->request->except('_token', 'submit'), $this->rules['create']);
     if ($validator->fails()) {
         return $this->redirector->back()->withInput()->withErrors($validator);
     }
     $this->scopes->create($this->request->get('id'), $this->request->get('description'));
     return $this->redirector->route('oauth.scopes.index')->with('success', "Scope added successfully.");
 }
开发者ID:jorycn,项目名称:oauth2-server-manager,代码行数:14,代码来源:ScopeController.php

示例3: getShow

 public function getShow($hash)
 {
     $paste = $this->repository->getByHash($hash);
     if (!$paste) {
         return $this->redirector->back();
     }
     $this->title = 'Paste Viewer';
     $this->render('bin.show', compact('paste'));
 }
开发者ID:sdlyhu,项目名称:laravelio,代码行数:9,代码来源:BinController.php

示例4: store

 public function store()
 {
     $validator = $this->validationFactory->make($this->request->except('_token', 'submit'), $this->rules['create']);
     if ($validator->fails()) {
         return $this->redirector->back()->withInput()->withErrors($validator);
     }
     $this->clients->create($this->request->get('name'), $this->request->get('redirect_uri'), (array) $this->request->get('grants'), (array) $this->request->get('scopes'));
     return $this->redirector->route('oauth.clients.index')->with('success', "Client added successfully.");
 }
开发者ID:jorycn,项目名称:oauth2-server-manager,代码行数:9,代码来源:ClientController.php

示例5: putUpdate

 public function putUpdate(Post $ad)
 {
     $inputs = $this->request->only('subject', 'permalink', 'content');
     $rules = ['subject' => ['required', 'max:200'], 'permalink' => ['max:200'], 'content' => ['']];
     $inputs['permalink'] = $this->slug($inputs['permalink']);
     $validator = Validator::make($inputs, $rules);
     if ($validator->fails()) {
         return $this->redirector->back()->withErrors($validator)->withInput($inputs);
     }
     $ad->subject = $inputs['subject'];
     $ad->permalink = $inputs['permalink'];
     $ad->content = $inputs['content'];
     $ad->save();
     return $this->redirector->route('ad.list');
 }
开发者ID:PhonemeCms,项目名称:cms,代码行数:15,代码来源:AdController.php

示例6: postReset

 public function postReset()
 {
     $credentials = $this->request->only('email', 'password', 'password_confirmation', 'token');
     $response = $this->password->reset($credentials, function ($user, $password) {
         $user->password = $this->hasher->make($password);
         $user->save();
     });
     switch ($response) {
         case $this->password->INVALID_PASSWORD:
         case $this->password->INVALID_TOKEN:
         case $this->password->INVALID_USER:
             return $this->redirector->back()->with('error', $this->translator->get($response));
         case $this->password->PASSWORD_RESET:
             return $this->redirector->to('/');
     }
 }
开发者ID:PhonemeCms,项目名称:cms,代码行数:16,代码来源:RemindersController.php

示例7: store

 public function store($listId, Request $request)
 {
     $email = trim($request->input('email'));
     $name = trim($request->input('name'));
     if (!$this->emailValidator->isValid($email)) {
         if ($request->wantsJson()) {
             return ['status' => 'invalid'];
         }
         return $this->redirector->back()->withInput()->withErrors(['Ongeldig e-mailadres']);
     }
     $this->mailgun->addMember($listId, $email, $name);
     if ($request->wantsJson()) {
         return ['status' => 'ok'];
     }
     return $this->redirectToList($listId);
 }
开发者ID:jeroennoten,项目名称:laravel-newsletter,代码行数:16,代码来源:Members.php

示例8: handle

 /**
  * Handle the form.
  *
  * @param Repository $cache
  * @param Redirector $redirect
  * @param            $key
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function handle(Repository $cache, Redirector $redirect, $key)
 {
     $parameters = $cache->get('form::' . $key);
     $criteria = $this->dispatch(new GetFormCriteria($parameters));
     /* @var FormBuilder $builder */
     $builder = $criteria->builder();
     $response = $builder->build()->post()->getFormResponse();
     $builder->flash();
     if ($response && $response->getStatusCode() !== 200) {
         return $response;
     }
     if ($builder->hasFormErrors()) {
         return $redirect->back();
     }
     return $response ?: $redirect->back();
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:24,代码来源:FormController.php

示例9: handle

 /**
  * @param  UserAuthenticator                      $authenticator
  * @param  MessageBag                             $message
  * @param  Redirector                             $redirect
  * @return bool|\Illuminate\Http\RedirectResponse
  */
 public function handle(UserAuthenticator $authenticator, MessageBag $message, Redirector $redirect)
 {
     if (!$this->user->isActivated()) {
         $message->error('Your account has not been activated.');
         $authenticator->logout();
         // Just in case.
         return $redirect->back();
     }
     if (!$this->user->isEnabled()) {
         $message->error('Your account has been disabled.');
         $authenticator->logout();
         // Just in case.
         return $redirect->back();
     }
     return true;
 }
开发者ID:anomalylabs,项目名称:user_security_check-extension,代码行数:22,代码来源:CheckUser.php

示例10: redirectWithFlashMessage

 /**
  * Set a flash message and either redirect to a given route or the last page
  *
  * @param string $key The session flash message key
  * @param string $message The session flash message value
  * @param string|null $route The Route name to redirect to (can be left empty to just redirect back)
  * @param array $parameters Parameters for the route (See the Laravel documentation)
  * @param int $status Status code for the route (See the Laravel documentation)
  * @param array $headers Headers for the route (See the Laravel documentation)
  * @return \Illuminate\HTTP\RedirectResponse
  */
 public function redirectWithFlashMessage($key, $message, $route = null, $parameters = array(), $status = 302, $headers = array())
 {
     $this->session->flash($key, $message);
     if (!is_null($route)) {
         return $this->redirect->route($route, $parameters = array(), $status = 302, $headers = array());
     }
     return $this->redirect->back();
 }
开发者ID:LaraGit,项目名称:larapress,代码行数:19,代码来源:Helpers.php

示例11: handle

 /**
  * Handle the command.
  *
  * @param StandardFormBuilder $builder
  * @return StandardFormBuilder
  */
 public function handle(StandardFormBuilder $builder, Redirector $redirect)
 {
     $stream = $this->form->getFormEntriesStream();
     $builder->on('saved', function (FormMailer $mailer, FormAutoresponder $autoresponder) use($builder) {
         $mailer->send($this->form, $builder);
         $autoresponder->send($this->form, $builder);
     });
     return $builder->setActions(['submit'])->setModel($stream->getEntryModel())->setOption('panel_class', 'section')->setOption('enable_defaults', false)->setOption('url', 'forms/handle/' . $this->form->getFormSlug())->setOption('success_message', $this->form->getSuccessMessage() ?: false)->setOption('redirect', $this->form->getSuccessRedirect() ?: $redirect->back());
 }
开发者ID:anomalylabs,项目名称:standard_form-extension,代码行数:15,代码来源:GetStandardFormBuilder.php

示例12: convertValidationExceptionToResponse

 /**
  * @param \Illuminate\Validation\ValidationException $exception
  * @param \Illuminate\Http\Request                   $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function convertValidationExceptionToResponse(ValidationException $exception, $request)
 {
     if ($exception->response) {
         return $exception->response;
     }
     $errors = $exception->validator->errors()->getMessages();
     if ($request->expectsJson()) {
         return $this->response->json($errors, 422);
     }
     return $this->redirector->back()->withInput($request->input())->withErrors($errors);
 }
开发者ID:notadd,项目名称:framework,代码行数:17,代码来源:Handler.php

示例13: redirect

 /**
  * The redirect handles redirecting appropriately based on the
  * condition object passed in. The condition object is a json like
  * stdClass object that mimics the arrays inside of config/permissions-conditions
  *
  * @param $conditionObject
  * @throws \Devise\Support\DeviseException
  */
 public function redirect($conditionObject)
 {
     // Default to 'back'
     $redirectType = isset($conditionObject->redirect_type) ? $conditionObject->redirect_type : 'back';
     $redirectMessage = isset($conditionObject->redirect_message) ? $conditionObject->redirect_message : '';
     switch ($redirectType) {
         case 'route':
         case 'to':
         case 'action':
             return $this->Redirect->{$redirectType}($conditionObject->redirect)->with('message-errors', $redirectMessage);
             break;
         default:
         case 'back':
             try {
                 return $this->Redirect->back()->with('message-errors', $redirectMessage);
             } catch (\Exception $e) {
                 throw new \Devise\Support\DeviseException('Unable to go back due to no referrer.');
             }
             break;
     }
 }
开发者ID:devisephp,项目名称:cms,代码行数:29,代码来源:RedirectHandler.php

示例14: handle

 /**
  * Handle the form response.
  *
  * @param FormBuilder $builder
  */
 public function handle(FormBuilder $builder)
 {
     /**
      * If the form already has a response
      * then we're being overridden. Abort!
      */
     if ($builder->getFormResponse()) {
         return;
     }
     $entry = $builder->getFormEntry();
     $actions = $builder->getFormActions();
     $action = $actions->active();
     if ($entry && $entry instanceof Arrayable) {
         $entry = $entry->toArray();
     }
     $redirect = $action->getRedirect();
     if ($redirect instanceof RedirectResponse) {
         $builder->setFormResponse($redirect);
         return;
     }
     if ($redirect === false) {
         return;
     }
     $redirect = $this->parser->parse($redirect, compact('entry'));
     /**
      * If the redirect is null then use the current one.
      */
     if ($redirect === null) {
         $redirect = $this->redirector->back()->getTargetUrl();
     }
     /**
      * If the URL is a closure then call it.
      */
     if ($redirect instanceof \Closure) {
         $redirect = app()->call($redirect, compact('builder'));
     }
     $builder->setFormResponse($this->redirector->to($redirect));
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:43,代码来源:ActionHandler.php

示例15: handle

 /**
  * Handle the request.
  *
  * @param \Illuminate\Http\Request $request
  * @param callable                 $next
  * @return \Illuminate\Http\RedirectResponse|mixed
  */
 public function handle($request, Closure $next)
 {
     // If the method is not a post - skip.
     if (!$request->isMethod('post')) {
         return $next($request);
     }
     // Get the route action.
     $action = $this->route->getAction();
     // If the route disabled the CSRF - skip.
     if (array_get($action, 'csrf') === false) {
         return $next($request);
     }
     /**
      * Try validating the CSRF token with the
      * base Laravel Middleware.
      */
     try {
         return parent::handle($request, $next);
     } catch (TokenMismatchException $e) {
         $this->messages->error('streams::message.csrf_token_mismatch');
         return $this->redirector->back();
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:30,代码来源:VerifyCsrfToken.php


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