php - Laravel - After login doesn't redirect -


when logged in can't redirect page. in inspector network page shows 302 found code.

enter image description here

the auth::attempt() , auth::check() returns both true when dd().

my code this:

    route::post('/login', function() {   //echo "login...";   $username = input::get('username');   $password = input::get('password');   $remember = input::get('remember');    $userdata = array(     'username'  => input::get('username'),     'password'  => input::get('password')   );   $rules = array(         'username' => 'required|exists:us,username',         'password' => 'required'   );    $validator = validator::make($userdata, $rules);    if ($validator->passes())   {     //dd(auth::attempt(['username' => $username, 'password' => $password], $remember));     if(auth::attempt(['username' => $username, 'password' => $password], $remember))     {       //echo "ok";       //dd(auth::check());       return redirect::to('app/');     }   }   else   {     //echo "error";     return redirect::to('login')->witherrors($validator);   } }); 

try this:

route.php

route::group(['middleware' => 'auth'], function() {     route::get('app/groups', function() {          return view('app.main-folders');      }); }); 

middleware


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -