refactor(livewire): organizar componentes y vistas por dominio en subnamespaces
- app/Livewire: 34 componentes agrupados en Issues/, Projects/, Phases/, Companies/, Users/, Admin/, Inspections/, Layers/, Media/, Common/ (Client/, Reports/, Forms/, Actions/ ya estaban). Namespaces actualizados. - resources/views/livewire: vistas sueltas movidas a subcarpetas espejo (companies/, users/, phases/, roles/, inspections/, media/, common/); render() actualizado. - Referencias actualizadas sin romper nada: rutas (FQN, nombres de ruta intactos), tags <livewire:...>/@livewire() a alias con punto, y use de los tests. - No tocado: Volt de Breeze (auth/profile/navigation), y el portal cliente (user-nav/client-projects) que ya tenía referencias inconsistentes. Verificado: 69 rutas OK, vistas compilan, suite 69 passing (solo 2 pre-existentes sqlite). autoload regenerado con --ignore-platform-reqs (PHP 8.2). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Common;
|
||||
|
||||
use Livewire\Component;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class NotificationBell extends Component
|
||||
{
|
||||
public $notifications = [];
|
||||
public $unreadCount = 0;
|
||||
public $showDropdown = false;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->loadNotifications();
|
||||
}
|
||||
|
||||
public function loadNotifications()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$this->notifications = $user->notifications()->latest()->take(10)->get()->toArray();
|
||||
$this->unreadCount = $user->unreadNotifications()->count();
|
||||
}
|
||||
|
||||
public function markAsRead($id)
|
||||
{
|
||||
Auth::user()->notifications()->where('id', $id)->update(['read_at' => now()]);
|
||||
$this->loadNotifications();
|
||||
}
|
||||
|
||||
public function markAllAsRead()
|
||||
{
|
||||
Auth::user()->unreadNotifications->markAsRead();
|
||||
$this->loadNotifications();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.common.notification-bell');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user