Skip to content

acoustep/factory-generator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Model Factory Generator

This package generates model factories from existing models using the new class-based factories in Laravel 8.

Installation

You may install this package via composer by running:

composer require --dev laravel-shift/factory-generator

The package will automatically register itself.

Usage

This package adds an artisan command for generating model factories.

Without any arguments, this command will generate model factories for all existing models within your Laravel application:

php artisan generate:factory

Similar to Laravel, this will search for models within the app/Models folder, or if that folder does not exist, within the app folder.

To generate factories for models within a different folder, you may pass the --path option (or -p).

php artisan generate:factory --path=some/Other/Path

To generate a factory for a single model, you may pass the model name:

php artisan generate:factory User

By default nullable columns are not included in the factory definition. If you want to include nullable columns you may set the --include-nullable option (or -i).

php artisan generate:factory -i User

Attribution

This package was original forked from Naoray/laravel-factory-prefill by Krishan König.

It has diverged to support the latest version of Laravel and to power part of the automation by the Tests Generator.

Contributing

Contributions should be submitted to the master branch. Any submissions should be complete with tests and adhere to the PSR-2 code style. You may also contribute by opening an issue.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%