$value){ if (is_array($value))$query->whereIn($column,$value); else $query->where($column,$value); } return $query->get(); }); } function firstOrCreate(array $kvPairs){ $materialBox=$this->get($kvPairs); if($materialBox->isNotEmpty()) return $materialBox->first(); return MaterialBox::query()->create($kvPairs); } }