Skip to main content

"Black Friday" Discount! Only until December 1st: 50% off all membership plans!

Read more here
Quick Tip

Log Long Running Laravel Queries

DB::enableQueryLog();
 
DB::whenQueryingForLongerThen(1000, function ($connection) {
Log::warning(
'Long running queries have been detected.',
$connection->getQueryLog()
);
});

Tip given by @realstevebauman

Enjoyed This Tip?

Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.

Recent Courses on Laravel Daily

Marketing for Developers in 2026

7 lessons
52 min

Next.js Basics for Laravel Developers

11 lessons
58 min

Roles and Permissions in Laravel 13

14 lessons
57 min