añadir funicionalidades de permisos y grupos
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
2025-04-27 23:43:22 +02:00
parent fa7c92bee2
commit 883daf32ed
51 changed files with 2673 additions and 441 deletions

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('groups', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->text('description')->nullable();
$table->timestamps();
$table->softDeletes();
});
Schema::create('group_user', function (Blueprint $table) {
$table->foreignId('group_id')->constrained()->onDelete('cascade');
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->timestamps();
$table->primary(['group_id', 'user_id']);
});
Schema::create('group_has_permissions', function (Blueprint $table) {
$table->foreignId('group_id')->constrained()->onDelete('cascade');
$table->foreignId('permission_id')->constrained()->onDelete('cascade');
$table->timestamps();
$table->primary(['group_id', 'permission_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('groups');
Schema::dropIfExists('group_user');
Schema::dropIfExists('group_has_permissions');
}
};

View File

@@ -11,11 +11,8 @@ return new class extends Migration
*/
public function up(): void
{
Schema::create('category_project', function (Blueprint $table) {
$table->id();
$table->foreignId('project_id')->constrained();
$table->foreignId('category_id')->constrained();
$table->timestamps();
Schema::table('users', function (Blueprint $table) {
$table->softDeletes();
});
}
@@ -24,6 +21,9 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('category_project');
Schema::table('users', function (Blueprint $table) {
$table->dropSoftDeletes();
});
}
};