Laravel – Log All SQL Queries
If you want to log all SQL queries to the laravel.log file use the following code in your AppServiceProvider.php - boot() method: class AppServiceProvider extends ServiceProvider { // ... public…
If you want to log all SQL queries to the laravel.log file use the following code in your AppServiceProvider.php - boot() method: class AppServiceProvider extends ServiceProvider { // ... public…
Laravel offers several ways to check the performance of an eloquent query. 1] Using DB query log You can log the SQL queries and get the performance of individual queries…
As highlighted by Povilas Korop (@PovilasKorop) on Twitter: in Laravel, you can call a static "saved" function on your model to forget the cached values with a specific key. Let's…
In a tweet by Tom Herrmann (@devgummibeer) (https://gummibeer.dev/), he discussed how using syncWithoutDetaching() call can kill a database. Basically, instead of doing: $user->identifiers()->syncWithoutDetaching($identifiers); Do this: DB::table('identifier_user')->having()->insertOrIgnore( $identifiers->map(fn (Identifier $identifier) =>…