2023_05_05_090127_role_power.php 814 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Artisan;
  5. use Illuminate\Support\Facades\Schema;
  6. return new class extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. Schema::table('roles', function (Blueprint $table) {
  16. $table->integer('power')->after("color")->default(50);
  17. });
  18. Artisan::call('db:seed', [
  19. '--class' => 'PermissionsSeeder',
  20. '--force' => true
  21. ]);
  22. }
  23. /**
  24. * Reverse the migrations.
  25. *
  26. * @return void
  27. */
  28. public function down()
  29. {
  30. Schema::table('roles', function (Blueprint $table) {
  31. $table->dropColumn('power');
  32. });
  33. }
  34. };