DatabaseSeeder.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Database\Seeders;
  3. use http\Client\Curl\User;
  4. use Illuminate\Database\Eloquent\Factories\Factory;
  5. use app\model\Users;
  6. // use Illuminate\Database\Console\Seeds\WithoutModelEvents;
  7. use Illuminate\Database\Seeder;
  8. use Illuminate\Support\Str;
  9. use support\Db;
  10. class DatabaseSeeder extends Seeder
  11. {
  12. public function __construct()
  13. {
  14. Factory::guessFactoryNamesUsing(function (string $modelName) {
  15. return 'Database\\Factories\\' . class_basename($modelName) . 'Factory';
  16. });
  17. Factory::guessModelNamesUsing(function (Factory $factory) {
  18. return 'app\\model\\' . str_replace('Factory', '', class_basename($factory));
  19. });
  20. }
  21. /**
  22. * Seed the application's database.
  23. */
  24. public function run(): void
  25. {
  26. /*
  27. * [
  28. 'name' => 'admin',
  29. 'email' => Str::random(10).'@qq.com',
  30. 'password' => ('<PASSWORD>')
  31. ]
  32. */
  33. Users::factory(10)->create();
  34. }
  35. }