I am using "cartalyst/sentry": "2.1.*" in my laravel 4.2
All things are working fine on my local server, but I am unable to use sentry on live server.
My issue is that I am unable to get Sentry user on routes.php
$credentials = array("email" => $postData["email"], "password" => $postData["password"]);
// Authenticate the user
$user = Sentry::authenticate($credentials, false);
if ($user) {
// its redirecting fine for both usres
if($user->hasAccess('admin')){
return Redirect::to('admin/index');
}
if($user->hasAccess('Advertiser')){
return Redirect::to('advertiser');
}
Things are working fine here, I am able to get user by Sentry::getUser() and also check the user access, and its also redirecting to the particular route.
But on my routes.php
Route::get('advertiser', ['as' => 'advertiser' function () {
// I am not getting user here, and it redirects user to index route
if (!Sentry::check()) {
return Redirect::to('index');
}
else {
return View::make('advertiser-home');
}
}]);
I have checked a lot, but did not find sentry working on any page.
Please help me.
This was causing due to caching. What I did was ran following commands:
With these commands my
debugbarandSentryboth started working. In case still you face any issue, tryI am using Laravel 5.2 and these commands helped to get both working.