Sentry is not working on my live server

1.1k Views Asked by At

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.

1

There are 1 best solutions below

1
Tarunn On

This was causing due to caching. What I did was ran following commands:

php artisan route:clear
php artisan config:clear

With these commands my debugbar and Sentry both started working. In case still you face any issue, try

php artisan view:clear

I am using Laravel 5.2 and these commands helped to get both working.