still not show the session,
they said to add this in my route:
Route::group(['middleware' => 'web'], function () { Route::post('loginAction', 'LoginController@loginAction');
Route::get('profile', [
'as' => 'profile',
'uses' => 'UserController@getProfile'
]);
});
also not show anything and show the error: TokenMismatchException in VerifyCsrfToken.php line 67:>scosec said:
$personal_id = session('personal_id'); echo $personal_id;
token mismatch means you didn't set the csrf token in the login form
It solved thanks to alainbelez, how to solve it:
Route::group(['middleware' => 'web'], function () { Route::get('login', function () { return view('login'); });
Route::post('loginAction', 'LoginController@loginAction');
Route::get('profile', [
'as' => 'profile',
'uses' => 'UserController@getProfile'
]);
});
do not forget to add input type hidden token
<form class="form-grey-fields" method="POST" action="loginAction"> <input type="hidden" name="_token" value="{!! csrf_token() !!}"> <div class="form-group"> <label class="sr-only">Email</label> <input type="email" name="email" placeholder="Email" class="form-control"> </div>
<div class="form-group m-b-5">
<label class="sr-only">Password</label>
<input type="password" name="password" placeholder="Password" class="form-control">
</div>
<div class="form-group form-inline text-left m-b-10 ">
<div class="checkbox">
<label>
<input type="checkbox"><small> Remember me</small>
</label>
</div>
<a class="right" href="#"><small>Lost your Password?</small></a>
</div>
<div class="text-left form-group">
<button class="btn btn-primary" type="submit">Login</button>
</div>
</form>
Thanks
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community