20231229043002_version206.php 768 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. use think\facade\Db;
  3. use think\migration\Migrator;
  4. class Version206 extends Migrator
  5. {
  6. /**
  7. * @throws Throwable
  8. */
  9. public function up(): void
  10. {
  11. $exist = Db::name('config')->where('name', 'backend_entrance')->value('id');
  12. if (!$exist) {
  13. $rows = [
  14. [
  15. 'name' => 'backend_entrance',
  16. 'group' => 'basics',
  17. 'title' => 'Backend entrance',
  18. 'type' => 'string',
  19. 'value' => '/admin',
  20. 'rule' => 'required',
  21. 'weigh' => 1,
  22. ],
  23. ];
  24. $table = $this->table('config');
  25. $table->insert($rows)->saveData();
  26. }
  27. }
  28. }