model; if (count($data) > 0) { foreach ($data as $key => $value) { $model = $model->where($key, $value); } return $model->first(); } return null; } public function deleteRawTime(int $time = 0) { $items = $this->model->whereRaw("UNIX_TIMESTAMP() - last_visited > $time")->get(); foreach ($items as $item) { $this->delete($item->id); } return $this; } public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*']) { $model = $this->model->with($relationships)->select($select); return $model->get(); } }