7d854ffb0a
- Translation system: lang/es/ PHP files (auth, validation, pagination, passwords)
- Rappasoft vendor translations published (lang/vendor/livewire-tables/es/)
- JSON files synced to 391 keys (EN + ES, full parity)
- APP_LOCALE changed to 'es', users.locale column default changed to 'es'
- Language switcher fixed: JS event + window.location.reload() avoids /livewire/update redirect
- SetLocale middleware fallback uses config('app.locale') instead of hardcoded 'en'
- setSortingPillsEnabled(false) on ProjectTable, CompanyTable, UserTable
- Translated 17 blade views: project-map, template-manager, layer-manager,
company-management, phase-list, media-manager, reports-dashboard,
client-projects, layer-upload, project-form, project-map-editor-tab,
admin/users, projects/media, projects/templates, layouts/client
- Navigation 'Empresas' link uses __('Companies')
- Fixed typo key 'Fases and layers' -> 'Phases and layers'
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
962 B
PHP
43 lines
962 B
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
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.notification-bell');
|
|
}
|
|
}
|