New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

luizneves01/smart-seeder

Versioned, environment-based Seeders in Laravel.
161,441
Install
composer require luizneves01/smart-seeder
Latest Version:8.0.0
PHP:>=7.4.0
Laravel:8 · 9
License:MIT
Last Updated:Jun 7, 2022
Links: GitHub  ·  Packagist
Maintainer: lftn01

LaravelSeeder

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?

LaravelSeeder takes the database migration features in Laravel and extends them to database seeders, making them "migratable". All of the functionality you have grown accustomed to with Laravel migrations have been mirrored and behave similarly for seeders.

Requirements

  • Laravel >= 8.0
  • PHP >= 7.4

Installation

  • Run composer require luizneves01/smart-seeder
  • 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

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.
  • Allows you to run multiple seeds of the same model/table
  • Prompts you if your database is in production

Usage

When you install LaravelSeeder, various artisan commands are made available to you which use the same methodology you're used to using with Migrations.

seedRuns all the seeds in the "seeders" directory that haven't been run yet.
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:statusGets the status of each migratable seeder.
seed:makeMakes a new seed class in the environment you specify.
seed:installYou don't have to use this... it will be run automatically when you call "seed"

Related Packages

eighty8/laravel-seeder

Versioned, environment-based Seeders in Laravel

60,612 18
softheroes/migratable-seeder

Versioned, environment-based Seeders in Laravel. Seed your database with the rig...

5,810 1
betalabs/laravel-seeder

Versioned, environment-based Seeders in Laravel. Used while original does not up...

4,975 2
softheroes/laravel-seeder

Versioned, environment-based Seeders in Laravel. Used while original does not up...

4,408 1
jlapp/smart-seeder

Smart Seeder adds the same methology to seeding that is currently used with migr...

3,075 190

Version History

Version Released PHP Laravel License
8.0.0 >=7.4.0 ^8.0|^9.0 MIT
7.1.1 >=7.4.0 ^8.0|^9.0 MIT
7.1.0 >=7.4.0 ^8.0|^9.0 MIT
v7.0.9 ^7.4 ^9.0 MIT
7.0.7 ^7.0 ^9.0 MIT