Support the ongoing development of Laravel.io →
Database Architecture

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!

Last updated 3 years ago.
0

Sentry::getThrottleProvider()->disable(); I believe this is not a problem in sentry 3.0. I assume you are using 2.1.

Last updated 3 years ago.
0

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!

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

neon5 neon5 Joined 21 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.