Giter VIP home page Giter VIP logo

gardener's Introduction

Smart seeder for Laravel

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.

seed:runRuns all the seeds in the smartSeeds directory that haven't been run yet.
seed:makeMakes a new seed class in the environment you specify.
seed:rollbackRollback doesn't undo seeding (which would be impossible with an auto-incrementing primary key). It just allows you to re-run the last batch of seeds.
seed:resetResets all the seeds.
seed:refreshResets and re-runs all seeds.
seed:installYou don't have to use this... it will be run automatically when you call "seed"

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 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

gardener's People

Contributors

diegovilette avatar gizburdt avatar killmenot avatar pawlox avatar slampenny avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.