DictionarySeeder.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. use Illuminate\Database\Seeder;
  3. class DictionarySeeder extends Seeder
  4. {
  5. /**
  6. * Run the database seeds.
  7. *
  8. * @return void
  9. */
  10. public function run()
  11. {
  12. $values = collect([1 => '未提交审核', 2 => '正在审核', 3 => '审核失败', 4 => '审核通过', 5 => '已发布']);
  13. foreach($values as $key => $value) {
  14. \App\Models\BaseDictionaryOptionModel::firstOrCreate([
  15. 'dictionary_table_code' => 'auth',
  16. 'dictionary_code' => 'status',
  17. 'key' => $key,
  18. 'value' => $key,
  19. 'name' => $value
  20. ]);
  21. }
  22. $values = collect([1 => '类型1', 2 => '类型2', 3 => '类型3', 4 => '类型4']);
  23. foreach($values as $key => $value) {
  24. \App\Models\BaseDictionaryOptionModel::firstOrCreate([
  25. 'dictionary_table_code' => 'template',
  26. 'dictionary_code' => 'type',
  27. 'key' => $key,
  28. 'value' => $key,
  29. 'name' => $value
  30. ]);
  31. }
  32. }
  33. }