Created
May 27, 2020 15:05
-
-
Save Alexisgt01/ad7dbd01b74dbbaa023fd87b7624437e to your computer and use it in GitHub Desktop.
Laravel seeder : visual feedback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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