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.
<?php
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
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!
The Laravel portal for problem solving, knowledge sharing and community building.
The community