<?php

namespace Modules\Notice\Http\Livewire;

use Livewire\Component;
use Illuminate\Notifications\DatabaseNotification;

class UserNotices extends Component
{
    public function read(DatabaseNotification $notice)
    {
        $notice->markAsRead();
    }

    public function render()
    {
        $currentDate = date("Y-m-d");
        $startDate = date("Y-m-d", strtotime($currentDate . " -2 months"));
        return view('notice::user-notifications', [
            'notifications' => auth()->user()->notifications
        ]);
    }
}
