This is my first attempt at the laravel package and there was a problem when Auth :: attempt ($ credentials) works in my login controller, but when redirecting to a secure route or controller, the user is no longer authenticated. Below is my login controller method with redirect comments to the control panel.
public function attempt(Request $request){ $email = strtolower(strip_tags(htmlspecialchars($request->input('email')))); $password = strip_tags(htmlspecialchars($request->input('password'))); if (Auth::attempt(array('email' => $email, 'password' => $password))) {
Responding to valid credentials displays the correct user account, and Auth :: check returns true. But when redirecting to the administrator controller, the user is not authenticated. Below is the method of the administrator controller, which should output an authenticated user, but returns only "not registered".
public function index() { if(Auth::check()) print_r(Auth::user()); else echo "not logged"; }
Both controllers use Auth; their namespaces are consistent with vendor / package / pathToDir, db is configured correctly, and the encryption key is set. Any ideas on what's going wrong? Thanks
source share