intended() public method

Create a new redirect response to the previously intended location.
public intended ( string $default = '/', integer $status = 302, array $headers = [], boolean $secure = null ) : Illuminate\Http\RedirectResponse
$default string
$status integer
$headers array
$secure boolean
return Illuminate\Http\RedirectResponse
 /**
  * Handle the form.
  *
  * @param LoginFormBuilder  $builder
  * @param UserAuthenticator $authenticator
  * @param Redirector        $redirect
  */
 public function handle(LoginFormBuilder $builder, UserAuthenticator $authenticator, Redirector $redirect)
 {
     if (!($user = $builder->getUser())) {
         return;
     }
     $authenticator->login($user, $builder->getFormValue('remember_me'));
     $builder->setFormResponse($redirect->intended($builder->getFormOption('redirect', '/')));
 }
 /**
  * Handle the form.
  *
  * @param LoginFormBuilder  $builder
  * @param UserAuthenticator $authenticator
  * @param UserSecurity      $security
  * @param Redirector        $redirect
  */
 public function handle(LoginFormBuilder $builder, UserAuthenticator $authenticator, UserSecurity $security, Redirector $redirect)
 {
     if (!($user = $builder->getUser())) {
         return;
     }
     $response = $security->check($user);
     if ($response instanceof Response) {
         $authenticator->logout($user);
         $builder->setFormResponse($response);
         return;
     }
     $authenticator->login($user, $builder->getFormValue('remember_me'));
     $builder->setFormResponse($redirect->intended($builder->getFormOption('redirect', '/')));
 }
 /**
  * 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();
 }
Example #4
0
 /**
  * Create a new redirect response to the previously intended location.
  *
  * @param string $default
  * @param int $status
  * @param array $headers
  * @param bool $secure
  * @return \Illuminate\Http\RedirectResponse 
  * @static 
  */
 public static function intended($default = '/', $status = 302, $headers = array(), $secure = null)
 {
     return \Illuminate\Routing\Redirector::intended($default, $status, $headers, $secure);
 }
Example #5
0
 /**
  * Create a new redirect response to the previously intended location.
  *
  * @param  string  $default
  * @param  int     $status
  * @param  array   $headers
  * @param  bool    $secure
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function redirectToIntended($default = '/', $status = 302, $headers = array(), $secure = null)
 {
     return $this->redirector->intended($default, $status, $headers, $secure);
 }