You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ExampleSeeder.php 1.2KB

2 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Tests\Support\Database\Seeds;
  3. use CodeIgniter\Database\Seeder;
  4. class ExampleSeeder extends Seeder
  5. {
  6. public function run()
  7. {
  8. $factories = [
  9. [
  10. 'name' => 'Test Factory',
  11. 'uid' => 'test001',
  12. 'class' => 'Factories\Tests\NewFactory',
  13. 'icon' => 'fas fa-puzzle-piece',
  14. 'summary' => 'Longer sample text for testing',
  15. ],
  16. [
  17. 'name' => 'Widget Factory',
  18. 'uid' => 'widget',
  19. 'class' => 'Factories\Tests\WidgetPlant',
  20. 'icon' => 'fas fa-puzzle-piece',
  21. 'summary' => 'Create widgets in your factory',
  22. ],
  23. [
  24. 'name' => 'Evil Factory',
  25. 'uid' => 'evil-maker',
  26. 'class' => 'Factories\Evil\MyFactory',
  27. 'icon' => 'fas fa-book-dead',
  28. 'summary' => 'Abandon all hope, ye who enter here',
  29. ],
  30. ];
  31. $builder = $this->db->table('factories');
  32. foreach ($factories as $factory) {
  33. $builder->insert($factory);
  34. }
  35. }
  36. }