簡體   English   中英

Sentry無法在我的實時服務器上工作

[英]Sentry is not working on my live server

我在laravel 4.2中使用"cartalyst/sentry": "2.1.*"

在我的本地服務器上一切正常,但是我無法在實時服務器上使用哨兵。

我的問題是我無法在routes.php上獲取Sentry用戶

$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');
            }

在這里一切正常,我可以通過Sentry::getUser()獲取用戶,並檢查用戶訪問權限,並將其重定向到特定的路由。

但是在我的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');
}
}]);

我已經檢查了很多,但沒有發現哨兵在任何頁面上都能正常工作。

請幫我。

這是由於緩存引起的。 我所做的是運行以下命令:

php artisan route:clear
php artisan config:clear

使用這些命令,我​​的debugbarSentry都開始工作。 萬一您仍然遇到任何問題,請嘗試

php artisan view:clear

我正在使用Laravel 5.2,這些命令有助於使兩者都正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM