namespace App\Providers; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\DB; use Illuminate\Database\Connection; use Illuminate\Support\Facades\Log; class AppServiceProvider extends ServiceProvider { public function boot() { DB::whenQueryingForLongerThan(500, function (Connection $connection) { Log::warning("Database queries exceeded 5 seconds on {$connection->getName()}"); // or notify the development team... }); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter