TOPIC COLLECTION
Log and debug.
A collection of 8 practical ideas to make everyday Laravel work a little smoother.
08 TIPS01Logging with ParametersYou can write Log::info() , or shorter info() message with additional parameters, for more context about what happened.Log and debug02Log Long Running Laravel QueriesPractical Laravel guidance for log long running laravel queries, with examples and copyable PHP code.Log and debug03Benchmark ClassIn Laravel 9.32 we have a Benchmark class that can measure the time of any task. It's a pretty useful helperLog and debug04More Convenient DdInstead of doing dd($result) you can put - dd() as a method directly at the end of your Eloquent sentence, or any Collection.Log and debug05Log with ContextNew in Laravel 8.49: Log::withContext() will help you to differentiate the Log messages between different requests.Log and debug06Quickly Output an Eloquent Query in Its SQL FormIf you want to quickly output an Eloquent query in its SQL form, you can invoke the toSql() method onto it like soLog and debug07Log All the Database Queries During DevelopmentIf you want to log all the database queries during development add this snippet to your AppServiceProviderLog and debug08Discover All Events Fired in One RequestIf you want to implement a new listener to a specific event but you don't know its name, you can log all events fired during the request.Log and debug