2026_05_14_000002_create_permissions_table.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. public function up(): void
  8. {
  9. Schema::create('permissions', function (Blueprint $table) {
  10. $table->id();
  11. $table->string('slug')->unique();
  12. $table->string('name');
  13. $table->text('description')->nullable();
  14. $table->string('module');
  15. $table->string('entity')->nullable();
  16. $table->string('field')->nullable();
  17. $table->string('action');
  18. $table->string('type')->default('action');
  19. $table->string('group')->nullable();
  20. $table->unsignedInteger('sort')->default(100);
  21. $table->boolean('is_system')->default(true);
  22. $table->timestamps();
  23. $table->index(['module', 'type']);
  24. $table->index(['module', 'field']);
  25. });
  26. }
  27. public function down(): void
  28. {
  29. Schema::dropIfExists('permissions');
  30. }
  31. };