<?php


namespace App\Services;


use App\StationTaskBatch;
use App\StationTaskChild;
use Illuminate\Support\Facades\Cache;
use App\Traits\ServiceAppAop;


class StationTaskChildService
{
    use ServiceAppAop;
    protected $modelClass=StationTaskChild::class;

    function get(array $kvPairs){
        ksort($kvPairs);
        return Cache::remember('stationTaskChild_'.md5(json_encode($kvPairs)), config('cache.expirations.oftenChange'), function ()use($kvPairs) {
            $query = StationTaskChild::query();
            foreach ($kvPairs as $column => $value){
                if (is_array($value))$query->whereIn($column,$value);
                else $query->where($column,$value);
            }
            return $query->get();
        });
    }

}
