Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ep#26: Clockwork, and the N+1 Problem
  • Loading branch information
arifktk32 committed Dec 17, 2021
1 parent 3f52a93 commit e3ff1bc
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 2 deletions.
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -8,6 +8,7 @@
"php": "^7.3|^8.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"itsgoingd/clockwork": "^5.1",
"laravel/framework": "^8.65",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
Expand Down
71 changes: 70 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion routes/web.php
Expand Up @@ -3,6 +3,7 @@
use App\Models\Category;
use Illuminate\Support\Facades\Route;
use App\Models\Post;
use Illuminate\Support\Facades\DB;

/*
|--------------------------------------------------------------------------
Expand All @@ -16,9 +17,13 @@
*/

Route::get('/', function () {

DB::listen(function($query) {
logger($query->sql, $query->bindings);
});

return view('posts', [
'posts' => Post::all()
'posts' => Post::with("category")->get()
]);
});

Expand Down
3 changes: 3 additions & 0 deletions storage/clockwork/.gitignore
@@ -0,0 +1,3 @@
*.json
*.json.gz
index

0 comments on commit e3ff1bc

Please sign in to comment.