2020_11_01_083237_update_admin_menu_table.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class UpdateAdminMenuTable extends Migration
  6. {
  7. public function getConnection()
  8. {
  9. return $this->config('database.connection') ?: config('database.default');
  10. }
  11. public function config($key)
  12. {
  13. return config('admin.' . $key);
  14. }
  15. /**
  16. * Run the migrations.
  17. *
  18. * @return void
  19. */
  20. public function up()
  21. {
  22. Schema::table($this->config('database.menu_table'), function (Blueprint $table) {
  23. $table->tinyInteger('show')->default(1)->after('uri');
  24. $table->string('extension', 50)->default('')->after('uri');
  25. });
  26. }
  27. /**
  28. * Reverse the migrations.
  29. *
  30. * @return void
  31. */
  32. public function down()
  33. {
  34. Schema::table($this->config('database.menu_table'), function (Blueprint $table) {
  35. $table->dropColumn('show');
  36. $table->dropColumn('extension');
  37. });
  38. }
  39. }