Skip to content

Instantly share code, notes, and snippets.

@nasrulhazim
Last active October 25, 2019 08:30
Show Gist options
  • Save nasrulhazim/3f057293c5dbac758716242e3c96ed82 to your computer and use it in GitHub Desktop.
Save nasrulhazim/3f057293c5dbac758716242e3c96ed82 to your computer and use it in GitHub Desktop.
Added Progress Bar on Seeding
<?php
namespace App\Traits;
trait SeedingProgressBar
{
public function run()
{
$seeders = $this->seeders;
$this->command->info('Seeding ' . __CLASS__ . '...');
$this->command->getOutput()->progressStart(count($seeders));
foreach ($seeders as $class => $is_class) {
if ($is_class) {
$this->call($class, true);
} else {
$method = $class;
$this->$method();
}
$this->command->getOutput()->progressAdvance();
}
$this->command->getOutput()->progressFinish();
}
}
@AlexMcowkin
Copy link

Hello. I have problem.
Illuminate\Contracts\Container\BindingResolutionException : Target class [MessageFactorySeeder] does not exist.

I have DatabaseSeeder and MessageFactorySeeder in one folder.

should I add something to composer?

    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/",
            "Database\\": "database/"
        }
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment