php - How to have conditional database seeding in Laravel? -


can create seed groups? instance have seeds want executed of time. how can add flag when executing php artisan migrate --seed --group1

what options such feature?

well, create multiple seeder extended classes, , having each 1 of them running $this->call() on specific group of tables , specify 1 want using --class flag. this:

class grouponedatabaseseeder extends seeder {      public function run() {         eloquent::unguard();          $this->call('usertableseeder');         $this->call('roletableseeder');     }  } 

and call way:

php artisan db:seed --class="grouponedatabaseseeder" 

well, or extend seedcommand add functionality via methods instead of classes.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -