<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class BandOriginHrrest extends SplitModel
{
    use HasFactory;

    public $fillable = ['user_id', 'band_id', 'date', 'value'];

    protected $casts = [
        'value' => 'array',
    ];
    
    public function scopeOwner($query, $user_id)
    {
        return $query->where("user_id", $user_id);
    }

    public function scopeBand($query, $band_id)
    {
        return $query->where("band_id", $band_id);
    }

    public function scopeTime($query, $start_time, $end_time)
    {
        return $query->where("date", '>=', $start_time)->where('date', '<',$end_time);

    }
}
