Laravel 5 after login, redirect back to previous/intended url ?

Laravel 5 after login, redirect back to previous/intended url ?

In this post, i will tell you how to redirect user back to URL they were trying to access before login using intended method.

You can also save the previous url in session so that you can easily redirect back to their previous url after authentication filter.

Example 1 : Using intended method
  1. public function auth()
  2. {
  3. if (Auth::attempt(['email' => $email, 'password' => $password])) {
  4. // Authentication passed...
  5. return redirect()->intended('dashboard');
  6. }
  7. }
Example 2: Using Session
  1. public function getLogin(Request $request)
  2. {
  3. $request->session()->put('url.intended',url()->previous());
  4. return view('login');
  5. }
  6. public function postLogin(Request $request)
  7. {
  8. if (Auth::attempt(['email' => $email, 'password' => $password])) {
  9. return redirect($request->session()->get('url.intended'));
  10. }
  11. return back();
  12. }

Phone: (+91) 8800417876
Noida, 201301
kadıköy escort tuzla escort kurtköy escort kartal escort maltepe escort bakırköy escort ataşehir escort
En kaliteli ve Gerçek sex hikaye 'lerini okuyabilir ve kendi seks hikayelerinizi paylaşabilirsiniz.
Türkiyenin en iyi hd porno izle sitesi 7dak ile doyumsuz türk sikişleri seyredin.
şişli escort
pendik escort
izmir escort izmir escort izmir escort izmir escort denizli escort antalya escort antalya escort antalya escort izmir escort izmir escort izmir escort izmir escort izmir escort
ankara escort
çeşme escort
kurtköy escort escort pendik
Betwinner