Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel log query for model (full)

namespace AppProviders;

use DB;
use Log;
use IlluminateSupportServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        DB::listen(function($query) {
            Log::info(
                $query->sql,
                $query->bindings,
                $query->time
            );
        });
    }

    // ...
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #log #query #model
ADD COMMENT
Topic
Name
8+4 =