/** * get latest section * @param $filter * @return \Illuminate\Database\Eloquent\Collection|static[] */ public function latest($filter) { $filter = array_only($filter, ['updated_at']); $query = $this->section->where(function ($q) use($filter) { foreach ($filter as $key => $value) { $q->where($key, '>', $value); } }); return $query->get(); }