feat(permissions): full permission catalogue grouped by section
- Migration: add 'group' and 'description' columns to the permissions table. - PermissionCatalogSeeder (idempotent updateOrCreate): full catalogue across 11 sections — Proyectos, Fases y progreso, Capas y elementos, Inspecciones, Incidencias, Empresas, Usuarios, Roles, Informes, Archivos, General. Sets group + description on existing and creates the new ones; does NOT touch role assignments. Registered in DatabaseSeeder. - RoleView: group permission toggles by the 'group' column in a defined section order and show each permission's description. DB updated locally (migrate + seed run). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$table = config('permission.table_names.permissions', 'permissions');
|
||||
|
||||
Schema::table($table, function (Blueprint $table) {
|
||||
if (! Schema::hasColumn($table->getTable(), 'group')) {
|
||||
$table->string('group')->nullable()->after('name');
|
||||
}
|
||||
if (! Schema::hasColumn($table->getTable(), 'description')) {
|
||||
$table->string('description')->nullable()->after('group');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
$table = config('permission.table_names.permissions', 'permissions');
|
||||
|
||||
Schema::table($table, function (Blueprint $table) {
|
||||
foreach (['group', 'description'] as $col) {
|
||||
if (Schema::hasColumn($table->getTable(), $col)) {
|
||||
$table->dropColumn($col);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user