Something was causing multiple calls to the User table. I found the solution on some blog that recommended using a singleton in filters.php.
App::before(function($request)
{
// Singleton (global) object
App::singleton('myApp', function(){
$app = new stdClass;
return $app;
});
$app = App::make('myApp');
View::share('myApp', $app);
if (!Sentry::check()) {
$app->isLogedin = FALSE;
}
else {
$app->user = Sentry::getUser();
$app->isLogedin = TRUE;
}
});
This works great. The User table is called one time and then I can get the user from this $app object.
I use the Ardent package but to get this to work I had to make the User model extend SentryUserModel instead of Ardent.
So, now what am I stuck on? I don't know what is calling the throttle table multiple times and I can't make it stop.
Here are the queries that run on my pages now.
users <- Yay! One time only!
throttle <- OK, this is fine.
cars <- Get the users active cars.
throttle <- Database hit again for the same query?
groups <- This is fine.
throttle <- Uggggg.
So something wants to keep querying the database for this throttle info.
Is there a way I can attach this throttle object also to my singleton and make the app (whatever is querying this table) get the info from my singleton instead of the database?
Thanks!
Sentry::getThrottleProvider()->disable();
I believe this is not a problem in sentry 3.0. I assume you are using 2.1.
The changelog.md under vendor\cartalyst\sentry says #v2.0.0-beta7.
I ran
composer update --dev --prefer-dist
But it did not update.
What is the best way to update to 3.0?
Thanks!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community