NotificationUserFilter.php 525 Bytes
<?php

namespace App\ModelFilters;

use App\Support\ModelFilter;
use Arr;

class NotificationUserFilter extends ModelFilter
{
    /**
     * @param int|array $status
     * @return void
     */
    public function status(array|int $status): void
    {
        $this->whereIn('status', Arr::wrap($status));
    }

    /**
     * @param int $status
     * @return void
     */
    public function readStatus(int $status): void
    {
        $status === 0 ? $this->whereNull('read_at') : $this->whereNotNull('read_at');
    }
}