slampenny / SmartSeeder by slampenny

Smart Seeder adds the same methology to seeding that is currently used with migrations in order to let you seed in batches, seed to production databases or other environments, and to rerun seeds without wiping out your data.
3,075
189
9
Package Data
Maintainer Username: slampenny
Maintainer Contact: jordan@jordanlapp.com (jlapp)
Package Create Date: 2014-11-13
Package Last Update: 2016-03-16
Language: PHP
License: MIT
Last Refreshed: 2024-03-27 03:01:17
Package Statistics
Total Downloads: 3,075
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 189
Total Watchers: 9
Total Forks: 58
Total Open Issues: 4

SmartSeeder for Laravel

For Laravel 5, please use the 5.0 branch!

For Laravel 4, please use the 4.2 branch!

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
    php artisan db:seed
    
    or
    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: "jlapp/smart-seeder": "dev-master" to your composer.json and run an update to bring it in (or run composer require jlapp/smartseeder).
  • Add 'Jlapp\SmartSeeder\SmartSeederServiceProvider' to your providers array in app/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