Skip to content

Instantly share code, notes, and snippets.

@Alexisgt01
Created May 27, 2020 15:05
Show Gist options
  • Save Alexisgt01/ad7dbd01b74dbbaa023fd87b7624437e to your computer and use it in GitHub Desktop.
Save Alexisgt01/ad7dbd01b74dbbaa023fd87b7624437e to your computer and use it in GitHub Desktop.
Laravel seeder : visual feedback
<?php
use Illuminate\Database\Seeder;
class AnyTableSeeder extends Seeder
{
private $max = 100;
public function run()
{
$fake = \Faker\Factory::create();
for ($i = 0; $i < $this->max; $i++) {
echo explode('\\', get_class())[sizeof(explode('\\', get_class())) - 1] . ' = ' . $i . '/' . $this->max . "\n";
// Do something
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment