I have a Route like below.
Route::group(['middleware' => ['web', 'auth']], function() {
Route::get('/My', array('uses' => 'AccountController@MyAccount', 'as' => 'Profile'));
});
We have a file with the name of RegisterUser.php
at this Path:
\vendor\laravel\framework\src\Illuminate\Foundation\Auth\RegistersUsers.php
After creating the user, redirecting user to a below Url
http://localhost/public/My
My code is like below.
public function register(RegisterRequest $request)
{
Auth::guard($this->getGuard())->login($this->create($request->all()));
//print_r(Auth::user());//Auth::user() is Not Null here
//die();
return \Redirect()->route('Profile');
}
but this always send user to Login Page. I also checked in Controller Action and Auth::user()
is null
public function MyAccount() {
echo '<pre>';
print_r(\Auth::user()); //It shows null value
echo '</pre>';
die();
return View("Account.Profile");
}
Am I missing something ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire