Support the ongoing development of →
Installation Database Packages
Last updated 2 years ago.

Found this post while looking for the solution, so adding this to help anyone else that needs it.

Your Seeder class was not namespace'd.


namespace PackageCompany\Package\Database\Seeds;

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder

then you can run

php artisan db:seed --class=PackageCompany\\Package\\Database\\Seeds\\DatabaseSeeder
Last updated 7 years ago.

Works with php artisan migrate:refresh && php artisan db:seed

Won't work with --seed, as no control over boot order with this code (inserts before tables are created).

 * Register seeds.
 * @param  string  $path
 * @return void
protected function registerSeedsFrom($path)
    foreach (glob("$path/*.php") as $filename)
        include $filename;
        $classes = get_declared_classes();
        $class = end($classes);

        $command = Request::server('argv', null);
        if (is_array($command)) {
            $command = implode(' ', $command);
            if ($command == "artisan db:seed") {
                Artisan::call('db:seed', ['--class' => $class]);


Sign in to participate in this thread!


Your banner here too?

ell ell Joined 3 Aug 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.