From 15fb2d089155047c455904b5731d67521daed1c7 Mon Sep 17 00:00:00 2001 From: roble Date: Thu, 11 Jun 2026 15:31:05 +0100 Subject: [PATCH 1/4] fix(blog): update BlogDatabaseSeeder to use firstOrCreate for categories and streamline image path handling --- database/seeders/BlogDatabaseSeeder.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/database/seeders/BlogDatabaseSeeder.php b/database/seeders/BlogDatabaseSeeder.php index 0365798..ac4789f 100644 --- a/database/seeders/BlogDatabaseSeeder.php +++ b/database/seeders/BlogDatabaseSeeder.php @@ -14,11 +14,12 @@ public function run(): void { $author = User::first(); - $gettingStarted = Category::create(['name' => 'Getting Started']); - $featuresModules = Category::create(['name' => 'Features & Modules']); - $devExperience = Category::create(['name' => 'Developer Experience']); + $gettingStarted = Category::firstOrCreate(['name' => 'Getting Started']); + $featuresModules = Category::firstOrCreate(['name' => 'Features & Modules']); + $devExperience = Category::firstOrCreate(['name' => 'Developer Experience']); $content = fn (string $file): string => file_get_contents(__DIR__.'/content/'.$file); + $image = fn (string $file): string => __DIR__.'/../../resources/assets/images/'.$file; $this->createPost([ 'title' => 'What Is Saucebase? The Modular Laravel Starter Kit', @@ -28,7 +29,7 @@ public function run(): void 'published_at' => now()->subMonths(5), 'category_id' => $gettingStarted->id, 'author_id' => $author?->id, - ], public_path('modules/blog/images/what-is-saucebase.jpg')); + ], $image('what-is-saucebase.jpg')); $this->createPost([ 'title' => 'Stop Rebuilding the Same Boilerplate Every Project', @@ -48,7 +49,7 @@ public function run(): void 'published_at' => now()->subMonths(3), 'category_id' => $devExperience->id, 'author_id' => $author?->id, - ], public_path('modules/blog/images/tech-stack.jpg')); + ], $image('tech-stack.jpg')); $this->createPost([ 'title' => 'Your First Module: Scaffold and Ship in Under 10 Minutes', @@ -58,7 +59,7 @@ public function run(): void 'published_at' => now()->subMonths(2), 'category_id' => $featuresModules->id, 'author_id' => $author?->id, - ], public_path('modules/blog/images/add-your-saucebase.jpg')); + ], $image('add-your-saucebase.jpg')); $this->createPost([ 'title' => 'Auth, Billing, and Privacy: The Three Modules Every SaaS Needs', @@ -68,7 +69,7 @@ public function run(): void 'published_at' => now()->subMonth(), 'category_id' => $featuresModules->id, 'author_id' => $author?->id, - ], public_path('modules/blog/images/cookies-or-privacy.jpg')); + ], $image('cookies-or-privacy.jpg')); $this->createPost([ 'title' => 'Copy-and-Own: The Philosophy Behind Saucebase Modules', @@ -78,7 +79,7 @@ public function run(): void 'published_at' => now()->subWeeks(2), 'category_id' => $devExperience->id, 'author_id' => $author?->id, - ], public_path('modules/blog/images/your-recipes.jpg')); + ], $image('your-recipes.jpg')); $this->createPost([ 'title' => 'Vue or React? What about both!', @@ -88,15 +89,15 @@ public function run(): void 'published_at' => now()->subDays(3), 'category_id' => $devExperience->id, 'author_id' => $author?->id, - ], public_path('modules/blog/images/vue-and-react.jpg')); + ], $image('vue-and-react.jpg')); } private function createPost(array $data, string $coverImage = ''): Post { - $post = Post::create($data); + $post = Post::firstOrCreate(['title' => $data['title']], $data); if ($coverImage && file_exists($coverImage)) { - $post->addMedia($coverImage)->preservingOriginal()->toMediaCollection('cover'); + $post->addMedia($coverImage)->preservingOriginal()->toMediaCollection('cover', 'public'); } return $post; From 2e1f77210294d93c08195cc551e76d156ef8fd04 Mon Sep 17 00:00:00 2001 From: roble Date: Thu, 11 Jun 2026 20:50:10 +0100 Subject: [PATCH 2/4] fix(blog): update Taskfile commands to use application context for consistency --- Taskfile.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 46b1848..a772547 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -5,7 +5,7 @@ tasks: # ── Testing ─────────────────────────────────────────────────── test:php: desc: Run PHPUnit tests for Blog module - cmd: php artisan test --testsuite=Modules --filter='^Modules\\Blog\\Tests' + cmd: 'php artisan test --testsuite=Modules --filter=''^Modules\\Blog\\Tests''' test:e2e: desc: Run E2E tests for Blog module @@ -16,10 +16,10 @@ tasks: db:seed: desc: Seed the Blog module database - cmd: php artisan modules:seed --module=blog + cmd: '{{.APP}} php artisan modules:seed --module=blog' # ── Code Generation ──────────────────────────────────────────── types:generate: desc: Generate TypeScript types from PHP DTOs and enums - cmd: php artisan module:generate-types blog + cmd: '{{.APP}} php artisan module:generate-types blog' From 10bb7b81f4ce81df934490a32b8be40ffe6379b5 Mon Sep 17 00:00:00 2001 From: roble Date: Thu, 11 Jun 2026 21:01:54 +0100 Subject: [PATCH 3/4] fix(blog): correct command syntax for PHPUnit test task in Taskfile --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index a772547..aa8bda6 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -5,7 +5,7 @@ tasks: # ── Testing ─────────────────────────────────────────────────── test:php: desc: Run PHPUnit tests for Blog module - cmd: 'php artisan test --testsuite=Modules --filter=''^Modules\\Blog\\Tests''' + cmd: php artisan test --testsuite=Modules --filter=''^Modules\\Blog\\Tests'' test:e2e: desc: Run E2E tests for Blog module From 1bb60f2f9812637dd5b1dac01e84696cfdb31467 Mon Sep 17 00:00:00 2001 From: roble Date: Thu, 11 Jun 2026 21:04:04 +0100 Subject: [PATCH 4/4] fix(blog): correct command syntax for PHPUnit test task in Taskfile --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index aa8bda6..25ac35b 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -5,7 +5,7 @@ tasks: # ── Testing ─────────────────────────────────────────────────── test:php: desc: Run PHPUnit tests for Blog module - cmd: php artisan test --testsuite=Modules --filter=''^Modules\\Blog\\Tests'' + cmd: php artisan test --testsuite=Modules --filter='^Modules\\Blog\\Tests' test:e2e: desc: Run E2E tests for Blog module