I have a auth problem with laravel sessions. (It was working in same system before)
This is my user controller
public function postLogin()
{
$username = Input::get("username");
$password = Input::get("password");
$credentials = array
(
"username"=> $username,
"password" => $password,
);
if (Auth::attempt($credentials))
{
echo Auth::user()->username;
exit();
}
else
{
return Redirect::to("user/login")->with("error_msg","Giriş Başarısız! <br>Lütfen girdiğiniz bilgileri kontrol edip yeniden deneyin.");
}
}
It returns username.. But when i redirect page session is losing.
public function postLogin()
{
$username = Input::get("username");
$password = Input::get("password");
$credentials = array
(
"username"=> $username,
"password" => $password,
);
if (Auth::attempt($credentials))
{
return Redirect::to('check_login');
}
else
{
return Redirect::to("user/login")->with("error_msg","Giriş Başarısız! <br>Lütfen girdiğiniz bilgileri kontrol edip yeniden deneyin.");
}
}
And My Route:
Route::get("check_login",function(){
echo Auth::user()->username;
});
The result:
ErrorException
Trying to get property of non-object
echo Auth::user()->username;
session.php
config file. Does thedomain
andpath
settings match with your dev environment? - fmgonzalezhttp://localhost/myproject/public/
or something like that it could be the problem. - fmgonzalez