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
ataşehir escort maltepe escort bostancı escort kadıköy escort maltepe escort ataşehir escort tuzla escort pendik escort ümraniye escort kartal 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
hatay escort nevsehir escort nigde escort kirikkale escort batman escort osmaniye escort kirklareli escort tokat escort rize escort adiyaman escort gumushane escort batman escort
porno izle
sohbet okey oyna
cialis satış cialis fiyat cialis 20 mg cialis 100 mg cialis 5 mg fiyat

viagra fiyatı

viagra 100 mg fiyat

viagra sipariş

orjinal viagra

viagra satın al

izmir escort