builder() ->where('ipd_id', $ipdId) ->orderBy('recorded_at', 'DESC') ->orderBy('id', 'DESC') ->limit($limit) ->get() ->getResultArray(); } public function getByIpdPeriod(int $ipdId, string $startDateTime, string $endDateTime, string $nurse = ''): array { $builder = $this->builder() ->where('ipd_id', $ipdId) ->where('recorded_at >=', $startDateTime) ->where('recorded_at <=', $endDateTime) ->orderBy('recorded_at', 'ASC') ->orderBy('id', 'ASC'); if ($nurse !== '') { $builder->where('recorded_by', $nurse); } return $builder->get()->getResultArray(); } }