chore: cleanup dead code + format with Pint
- Remove unused FeaturesController (empty stubs, no routes) - Remove ConvertSpatialFile CLI command (unused; service used in LayerManager) - Remove MigrateGeojsonToFeatures CLI command (one-shot migration, not referenced) - Remove .claude/worktrees/ (11 old agent worktrees from June) - Apply Laravel Pint formatting across 219 files (style only, no functional changes) Tests: 101 passing (319 assertions) API routes: unchanged (8 routes intact)
This commit is contained in:
@@ -2,23 +2,26 @@
|
||||
|
||||
namespace App\Livewire\Admin;
|
||||
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\Layout;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\User;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Component;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\PermissionRegistrar;
|
||||
|
||||
#[Layout('layouts.app')]
|
||||
class RoleView extends Component
|
||||
{
|
||||
public Role $role;
|
||||
|
||||
public string $tab = 'ficha'; // ficha | permisos
|
||||
|
||||
public $newUserId = '';
|
||||
|
||||
private const PROTECTED_ROLES = ['Admin'];
|
||||
|
||||
private const CORE_PERMISSION = 'manage all';
|
||||
|
||||
public function mount(Role $role): void
|
||||
@@ -38,7 +41,8 @@ class RoleView extends Component
|
||||
if ($this->role->name === 'Admin'
|
||||
&& $permissionName === self::CORE_PERMISSION
|
||||
&& $this->role->hasPermissionTo($permissionName)) {
|
||||
$this->dispatch('notify', "El rol Admin no puede perder '" . self::CORE_PERMISSION . "'.");
|
||||
$this->dispatch('notify', "El rol Admin no puede perder '".self::CORE_PERMISSION."'.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,6 +95,7 @@ class RoleView extends Component
|
||||
{
|
||||
if (in_array($this->role->name, self::PROTECTED_ROLES, true)) {
|
||||
$this->dispatch('notify', "El rol '{$this->role->name}' está protegido y no se puede borrar.");
|
||||
|
||||
return;
|
||||
}
|
||||
$this->role->delete();
|
||||
@@ -107,6 +112,7 @@ class RoleView extends Component
|
||||
return 'General';
|
||||
}
|
||||
$resource = Str::afterLast($name, ' ');
|
||||
|
||||
return Str::headline($resource ?: 'General');
|
||||
}
|
||||
|
||||
@@ -126,6 +132,7 @@ class RoleView extends Component
|
||||
->groupBy(fn ($perm) => $perm->group ?: $this->sectionFor($perm->name))
|
||||
->sortBy(function ($perms, $section) use ($order) {
|
||||
$i = array_search($section, $order, true);
|
||||
|
||||
return $i === false ? 999 : $i;
|
||||
});
|
||||
|
||||
@@ -133,11 +140,11 @@ class RoleView extends Component
|
||||
->orderBy('first_name')->orderBy('name')->get();
|
||||
|
||||
return view('livewire.roles.role-view', [
|
||||
'users' => $users,
|
||||
'users' => $users,
|
||||
'availableUsers' => $availableUsers,
|
||||
'grouped' => $grouped,
|
||||
'rolePerms' => $this->role->permissions->pluck('name')->toArray(),
|
||||
'isProtected' => in_array($this->role->name, self::PROTECTED_ROLES, true),
|
||||
'grouped' => $grouped,
|
||||
'rolePerms' => $this->role->permissions->pluck('name')->toArray(),
|
||||
'isProtected' => in_array($this->role->name, self::PROTECTED_ROLES, true),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user