alasit / gardener
Smart seeders for Laravel. created and developed by gizburdt
5.2.5
2016-03-24 20:42 UTC
Requires
- php: >=5.4.0
- illuminate/console: 5.2.*
- illuminate/database: 5.2.*
- illuminate/filesystem: 5.2.*
- illuminate/support: 5.2.*
Requires (Dev)
- henrikbjorn/phpspec-code-coverage: ~0.2
- phpspec/phpspec: ~2.0
This package is not auto-updated.
Last update: 2024-11-13 21:00:43 UTC
README
Seeding as it is currently done in Laravel is intended only for dev builds, but what if you're iteratively creating your database and want to constantly flush it and repopulate it during development? What if you want to seed a production database with different data from what you use in development? What if you want to seed a table you've added to a database that is currently in production with new data?
Features
- Allows you to seed databases in different environments with different values.
- Allows you to "version" seeds the same way that Laravel currently handles migrations. Running
php artisan seed
will only run seeds that haven't already been run. - Prompts you if your database is in production.
- Allows you to run multiple seeds of the same model/table
- Overrides Laravel's seeding commands. SmartSeeder will fire when you run
orphp artisan db:seed
php artisan migrate:refresh --seed
- You can run a single seed file with the --file option.
php artisan seed:run --file=seed_2015_05_27_030017_UserSeeder
Use
When you install SmartSeeder, various artisan commands are made available to you which use the same methodology you're used to using with Migrations.
Installation
- Add require:
"gizburdt/gardener": "5.2.*"
to your composer.json and run an update to bring it in (or run composer require jlapp/smartseeder). - Add
Jlapp\SmartSeeder\SmartSeederServiceProvider::class
to your providers array inapp/config/app.php
- Run
php artisan vendor:publish
to push config files to your config folder if you want to override the name of the seeds folder or the name of the table where seeds are stored