YzSystemSettingTableSeeder.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. use Illuminate\Database\Seeder;
  3. use \Illuminate\Support\Facades\DB;
  4. class YzSystemSettingTableSeeder extends Seeder
  5. {
  6. protected $table = 'yz_system_setting';
  7. /**
  8. * Run the database seeds.
  9. *
  10. * @return void
  11. */
  12. public function run()
  13. {
  14. if (!Schema::hasTable($this->table)) {
  15. echo $this->table . " 不存在 跳过\n";
  16. return;
  17. }
  18. $table = DB::table($this->table)->where('key', 'global')->first();
  19. if (!$table) {
  20. $config['image_extentions'] = ['0' => 'gif', '1' => 'jpg', '2' => 'jpeg', '3' => 'png'];
  21. $config['image_limit'] = 5000;
  22. $config['audio_extentions'] = ['0' => 'mp3', '1' => 'mp4'];
  23. $config['audio_limit'] = 5000;
  24. $config['thumb_width'] = 800;
  25. $config['zip_percentage'] = 100;
  26. DB::table($this->table)->insert([
  27. 'key' => 'global',
  28. 'value' => serialize($config),
  29. 'created_at' => time(),
  30. 'updated_at' => time()
  31. ]);
  32. }
  33. }
  34. }