debug Archives - 7-Views

How To Debug Queries In Laravel

Posted by
January 31, 2021

We can do this by #1 Simple Query Debugging $results = User::where(function($q) use ($request) { $q->orWhere(‘name’, ‘like’, ‘%7-Views%’); $q->orWhere(’email’, ‘=’, ‘info@7-views.com’); })->toSql(); The above method does not include query bindings. #2 Listening For Query Events \DB::listen(function($sql, $bindings, $time) { dump($sql); dump($bindings); dump($time); }); This method returns queries with timings and bindings.        

read more