unioil-cms-fe/app/Livewire/Notification.php

38 lines
829 B
PHP

<?php
namespace App\Livewire;
use Livewire\Component;
class Notification extends Component
{
public $search = '';
public $notifs = [];
// protected $queryString = ['search'];
// // Reset the current page when search is updated
// public function updatingSearch()
// {
// $this->search = $this->search;
// }
public function mount()
{
$this->loadNotifications();
}
// Get filtered users based on the search input
public function loadNotifications()
{
$this->notifs = collect(json_decode(file_get_contents(storage_path('app/notifs.json')), true));
}
public function render()
{
return view('livewire.notification.notification', [
'notification' => $this->notifs, // Pass filtered notifs here
]);
}
}