<?php

namespace Modules\HR\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Core\Traits\HasStatus;

// use Modules\HR\Database\Factories\HolidayAllowancePolicyFactory;

class HolidayAllowancePolicy extends Model
{
    use
        HasStatus,
        HasFactory;

    /**
     * The attributes that are mass assignable.
     */
    protected $fillable = [
        'name',
        'calculation_type',
        'amount',
        'multiplier',
        'status',
    ];

    public function scopeSearch($query, ?string $search)
    {
        if (blank($search)) {
            return $query;
        }
        $search = '%' . trim($search) . '%';

        return $query->where('name', 'like', $search);
    }


    // protected static function newFactory(): HolidayAllowancePolicyFactory
    // {
    //     // return HolidayAllowancePolicyFactory::new();
    // }
}
