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


PHP Redirector::to方法代码示例

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


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

示例1: filter

 public function filter(Route $route, Request $request)
 {
     if ($this->auth->check()) {
         $config = $this->config->get('c::redirect-login');
         $url = $config ? $this->url->to($config) : '/';
         return $this->redirect->to($url);
     }
 }
开发者ID:anlutro,项目名称:l4-core,代码行数:8,代码来源:GuestFilter.php

示例2: makeResponse

 protected function makeResponse(Request $request)
 {
     $message = $this->translator->get('c::auth.login-required');
     if ($request->ajax() || $request->isJson() || $request->wantsJson()) {
         return Response::json(['error' => $message], 403);
     } else {
         $url = $this->url->action('anlutro\\Core\\Web\\AuthController@login');
         $intended = $request->getMethod() == 'GET' ? $request->fullUrl() : ($request->header('referer') ?: '/');
         $this->session->put('url.intended', $intended);
         return $this->redirect->to($url)->with('error', $message);
     }
 }
开发者ID:anlutro,项目名称:l4-core,代码行数:12,代码来源:AuthFilter.php

示例3: handle

 /**
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->authenticator->isAuthenticated()) {
         return $this->redirector->to($this->config->get('littlegatekeeper.authRoute'));
     }
     return $next($request);
 }
开发者ID:spatie,项目名称:laravel-littlegatekeeper,代码行数:12,代码来源:AuthMiddleware.php

示例4: response

 /**
  * Get the proper failed validation response for the request.
  *
  * @param  array  $errors
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function response(array $errors)
 {
     if ($this->ajax() || $this->wantsJson()) {
         return new JsonResponse($errors, 422);
     }
     return $this->redirector->to($this->getRedirectUrl())->withInput($this->except($this->dontFlash))->withErrors($errors, $this->errorBag);
 }
开发者ID:realholgi,项目名称:cmsable,代码行数:13,代码来源:SearchRequest.php

示例5: create

 /**
  * Create a new Redirect response.
  *
  * @param RedirectInterface $redirect
  * @return \Illuminate\Http\RedirectResponse
  */
 public function create(RedirectInterface $redirect)
 {
     $parameters = array_merge(array_map(function () {
         return null;
     }, array_flip($this->route->parameterNames())), $this->route->parameters());
     return $this->redirector->to($this->parser->parse($redirect->getTo(), $parameters), $redirect->getStatus(), [], $redirect->isSecure());
 }
开发者ID:JoelESvensson,项目名称:redirects-module,代码行数:13,代码来源:RedirectResponse.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param Request $request
  * @param Closure $next
  *
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if (!$request->isSecure()) {
         return $this->redirector->to($request->getRequestUri(), 302, $request->headers->all(), true);
     }
     return $next($request);
 }
开发者ID:hughgrigg,项目名称:ching-shop,代码行数:15,代码来源:ForceSecure.php

示例7: select

 /**
  * @param $gamertag
  * @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
  */
 public function select($gamertag)
 {
     $players = destiny()->player($gamertag);
     if ($players->count() == 1) {
         return $this->redirect->to($players->first()->url);
     }
     return $this->view->make('select', ['gamertag' => $gamertag, 'players' => $players]);
 }
开发者ID:TrackerNetwork,项目名称:DestinyStatus,代码行数:12,代码来源:HomeController.php

示例8: view

 /**
  * Redirect to a post's URL.
  *
  * @param PostRepositoryInterface $posts
  * @param Redirector              $redirect
  * @param                         $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function view(PostRepositoryInterface $posts, Redirector $redirect, $id)
 {
     /* @var PostInterface $post */
     $post = $posts->find($id);
     if (!$post->isLive()) {
         return $redirect->to($this->dispatch(new GetPostPath($post)));
     }
     return $redirect->to($post->path());
 }
开发者ID:jacksun101,项目名称:posts-module,代码行数:17,代码来源:PostsController.php

示例9: view

 /**
  * Redirect to a partial's URL.
  *
  * @param PartialRepositoryInterface $partials
  * @param Redirector                 $redirector
  * @param                            $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function view(PartialRepositoryInterface $partials, Redirector $redirector, $id)
 {
     $first = $partials->first();
     $partial = $partials->find($id);
     // Redirect to home if this is the first partial.
     if ($first && $first->getId() === $partial->getId()) {
         return $redirector->to('/');
     }
     return $redirector->to($partial->path());
 }
开发者ID:AkibaTech,项目名称:partials-module,代码行数:18,代码来源:PartialsController.php

示例10: create

 /**
  * Create a new Redirect response.
  *
  * @param RedirectInterface $redirect
  * @return \Illuminate\Http\RedirectResponse
  */
 public function create(RedirectInterface $redirect)
 {
     $parameters = array_merge(array_map(function () {
         return null;
     }, array_flip($this->route->parameterNames())), $this->route->parameters());
     if (!starts_with($url = $redirect->getTo(), ['http://', 'https://', '//'])) {
         $url = $this->url->to($redirect->getTo(), [], $redirect->isSecure());
     }
     return $this->redirector->to(rtrim($this->parser->parse($url, $parameters), '/'), $redirect->getStatus());
 }
开发者ID:visualturk,项目名称:redirects-module,代码行数:16,代码来源:RedirectResponse.php

示例11: redirect

 /**
  * Redirect elsewhere.
  *
  * @param PageRepositoryInterface $pages
  * @param Redirector              $redirector
  * @param Route                   $route
  * @return \Illuminate\Http\RedirectResponse|void
  */
 public function redirect(PageRepositoryInterface $pages, Redirector $redirector, Route $route)
 {
     if ($to = array_get($route->getAction(), 'anomaly.module.pages::redirect')) {
         return $redirector->to($to, array_get($route->getAction(), 'status', 302));
     }
     /* @var PageInterface $page */
     if ($page = $pages->find(array_get($route->getAction(), 'anomaly.module.pages::page', 0))) {
         return $redirector->to($page->getPath(), array_get($route->getAction(), 'status', 302));
     }
     abort(404);
 }
开发者ID:AkibaTech,项目名称:pages-module,代码行数:19,代码来源:PagesController.php

示例12: view

 /**
  * Redirect to a page's URL.
  *
  * @param PageRepositoryInterface $pages
  * @param Redirector              $redirect
  * @param                         $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function view(PageRepositoryInterface $pages, Redirector $redirect, $id)
 {
     /* @var PageInterface $page */
     $page = $pages->find($id);
     if (!$page->isEnabled()) {
         return $redirect->to('pages/preview/' . $page->getStrId());
     }
     if ($page->isHome()) {
         return $redirect->to('/');
     }
     return $redirect->to($page->getPath());
 }
开发者ID:jacksun101,项目名称:pages-module,代码行数:20,代码来源:PagesController.php

示例13: postIndex

 /**
  * Show the login form
  *
  * @return mixed
  */
 public function postIndex()
 {
     // Pick up the honeypot field to stop bots, return to the login screen, no message
     if ($this->request->get('potter')) {
         return $this->redirect->to('auth/login')->withInput();
     }
     if (!$this->validator->with($this->request->all())->passes()) {
         return $this->redirect->to('auth/login')->withErrors($this->validator->errors());
     }
     if ($this->auth->attempt(['username' => $this->request->get('username'), 'password' => $this->request->get('password')])) {
         return $this->redirect->intended('/');
     }
     $this->session->flash('failed', trans('auth.incorrect_username_or_password'));
     return $this->redirect->to('auth/login')->withInput();
 }
开发者ID:jraymundoyrockdev,项目名称:api-gfccm-systems,代码行数:20,代码来源:AuthController.php

示例14: connect

 /**
  * Connect the current user to Last.fm.
  *
  * @param Redirector $redirector
  * @param Lastfm     $lastfm
  *
  * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
  */
 public function connect(Redirector $redirector, Lastfm $lastfm)
 {
     if (!$lastfm->enabled()) {
         abort(401, 'Koel is not configured to use with Last.fm yet.');
     }
     return $redirector->to('https://www.last.fm/api/auth/?api_key=' . $lastfm->getKey() . '&cb=' . route('lastfm.callback'));
 }
开发者ID:bearzk,项目名称:koel,代码行数:15,代码来源:LastfmController.php

示例15: 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


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