austintoddj / canvas

Publishing on your own terms
http://trycanvas.app
MIT License
3.27k stars 521 forks source link

Create a Model Factory for Canvas Posts #1422

Closed Jamesking56 closed 8 months ago

Jamesking56 commented 9 months ago

Is your feature request related to a problem? Please describe.

I'm trying to create a custom frontend for Canvas, but I need a lot of posts in order to effectively create and test pagination. It would make my life a lot easier if Canvas provided a Laravel Model Factory for Canvas Posts.

Describe the solution you'd like

I'd like the Canvas library to provide a default model factory which generates some blog posts using faker data. Optionally allow the user to override the factory class.

Describe alternatives you've considered

Making a seeder to manually populate the table is annoying and can be broken by newer versions of Canvas changing the database structure

Additional context

No response

Validations

austintoddj commented 8 months ago

@Jamesking56 There is a factory for posts, but there's no associated seeder files. It sounds like what you're looking for is a seeder, yes?

Jamesking56 commented 8 months ago

@Jamesking56 There is a factory for posts, but there's no associated seeder files. It sounds like what you're looking for is a seeder, yes?

Oh must've missed the factory file, we can probably make our own seeder as I doubt a seeder should belong in the package. Cheers.