Seeding database with path from code?

Dan picture Dan · Jul 17, 2013 · Viewed 8.5k times · Source

I've been using Laravel's migrations with the path parameter like so:

Artisan::call('migrate', array('--path' => 'path/to/my/Migrations'));

Is there anyway I can run the seed command in the same way? I have a number of seed files I want to use but I don't want to run them all at the same time.

Any advice appreciated.

Thanks

Answer

gellezzz picture gellezzz · Jan 11, 2016

Instead of --path you can set --class with namespace to Seeder class.

Artisan::call('db:seed', [
    '--class' => 'Namespace\Seeds\DatabaseSeeder'
]);

This work on Laravel 5.1