Conversation
…ies and streamline image path handling
There was a problem hiding this comment.
Pull request overview
This PR refactors the Blog module’s database seeding and developer Taskfile commands to be more consistent and safer to re-run, while updating how cover images are located and stored.
Changes:
- Made Blog category and post seeding idempotent via
firstOrCreate. - Switched seeded cover images to be sourced from
resources/assets/imagesand stored on thepublicdisk. - Updated Taskfile commands for seeding and type generation to run under an application context prefix, and adjusted PHPUnit filter quoting.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Taskfile.yml | Updates task commands (tests, seeding, TS type generation) for consistent execution context. |
| database/seeders/BlogDatabaseSeeder.php | Makes seeding re-runnable without duplicates and updates cover image path/disk handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| db:seed: | ||
| desc: Seed the Blog module database | ||
| cmd: php artisan modules:seed --module=blog | ||
| cmd: '{{.APP}} php artisan modules:seed --module=blog' |
| 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' |
Comment on lines
21
to
+22
| $content = fn (string $file): string => file_get_contents(__DIR__.'/content/'.$file); | ||
| $image = fn (string $file): string => __DIR__.'/../../resources/assets/images/'.$file; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves the seeding process for the Blog module to make it more robust and idempotent, and updates the way images are referenced and stored. It also updates the
Taskfile.ymlto ensure that database seeding and TypeScript type generation commands use the correct application context.Seeder Improvements:
BlogDatabaseSeeder.phpto usefirstOrCreate, preventing duplicate entries if the seeder is run multiple times. [1] [2]$imagehelper function, ensuring images are referenced from the correct location. [1] [2] [3] [4] [5] [6] [7]'public'disk when adding cover images, ensuring images are stored and served correctly.Taskfile Updates:
db:seedandtypes:generatecommands inTaskfile.ymlto run under the correct application context using the{{.APP}}variable.test:phpcommand to ensure the test filter is parsed correctly.