Support the ongoing development of Laravel.io →
Database Laravel
Last updated 1 year ago.
0
moderator Solution

The most easy part should be checking on the table and then escape it.

public function boot()
    {
        DB::listen(
            function ($query) {
                if (strpos($query->sql, 'querylogtable') !== false ) {
                    // we don't want to log about the logging
                    return;
                }
                QueryLog::create([
                    'sql' => $query->sql,
                    'bindings' => implode(', ', $query->bindings),
                    'time' => $query->time
                ]);
            }
        );
    }

I have used implode and not a foreach to glue the bindings

0

Sign in to participate in this thread!

Eventy

Your banner here too?

janakad janakad Joined 21 Sep 2016

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.

© 2024 Laravel.io - All rights reserved.