Download the PHP package singlequote/laravel-model-seeder without Composer
On this page you can find all versions of the php package singlequote/laravel-model-seeder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-model-seeder
Laravel Model Seeder
Create seeders from your model using the data in your database
This package will generate automatic seeders using your models. It supports pivot relations to automatic sync relations in pivot tables with your models.
Installation
Usage
The package has a single command line with a few options.
The command below will generate seeders using laravels default folder structure.
The seeders will be created in database/seeders
and your models should be in App\Models
Model events
By default laravel adds the WithoutModelEvents
trait to your seeders. The package does this also for abious reasons. If you would like to use your model events, you can add the --with-events
option to the command.
Changing the package behaviour
If you moved your models to another location or you renamed your Models folder to something else you can change this in the config of the package.
Publish config
Using the command you can publish the config and edit it.
The default content of the config file is:
Changing model location and seeder output
You can change your models location using the config or using the --path
option from your command line.
For example if you are using modules in your package and you want to create seeders for your module.
Seeder output location
The package will try to detect the output directory by checking the folder structure of your project and look for the database
folder.
If you changed this and the package can't detect the output path you can give the output path as a option with the command.
Auto retrieve all models
If you have multiple model locations and want to make seeders of them all. You can use the --path=auto
option. This option will import all declared classes and check if they extend the Model::class
.
Exclude models
By default the package will create seeders for every model in the given path. You can use the --only=..
option to exclude other models from the process.
Order seed data on column
By default the package will generate the data ordering by the id
column. you can change this using the orderBy
option.
Or order by desc
Contributing
Please see CONTRIBUTING for details.
Postcardware
You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Quotec, Traktieweg 8c 8304 BA, Emmeloord, Netherlands.
Credits
- Wim Pruiksma
- All Contributors
License
The MIT License (MIT). Please see License File for more information.