2019_07_15_151900_remove_third_level_v2.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use app\common\models\UniAccount;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class RemoveThirdLevelV2 extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. if (Schema::hasTable('yz_setting')) {
  15. $uniAccount = UniAccount::getEnable();
  16. foreach ($uniAccount as $u) {
  17. \YunShop::app()->uniacid = $u->uniacid;
  18. \Setting::$uniqueAccountId = $u->uniacid;
  19. $info = \Setting::get('relation_base');
  20. if ($info) {
  21. if ($info['relation_level'][2]) {
  22. unset($info['relation_level'][2]);
  23. }
  24. if ($info['relation_level']['name3']) {
  25. unset($info['relation_level']['name3']);
  26. }
  27. $request = Setting::set('relation_base',$info);
  28. }
  29. }
  30. }
  31. }
  32. /**
  33. * Reverse the migrations.
  34. *
  35. * @return void
  36. */
  37. public function down()
  38. {
  39. }
  40. }