dimanche 9 juin 2019

Error in redirect to previous page after successful register in Laravel?

I get this error "Header may not contain more than a single header, new line detected" when trying to redirect the user to the same page after successful registered. I can't see what I'm doing wrong

Here is the code in register controller

 public function showRegistrationForm()
 {
    if (session('link')) {
        $myPath     = session('link');
        $registerPath  = url('/register');
        $previous   = url()->previous();
        if ($previous = $registerPath)
        {
            session(['link' => $myPath]);
        }
        else
        {
            session(['link' => $previous]);
        }
    }
     else
     {
        session(['link' => url()->previous()]);
    }
    return view('auth.register');
  }

  protected function redirectTo()
  {
    return redirect(session('link'));
  }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire