db->get_where('accounting_periods', array('id' => (int) $id))->row(); } public function findByDate($date) { return $this->db ->where('start_date <=', $date) ->where('end_date >=', $date) ->limit(1) ->get('accounting_periods') ->row(); } public function allWithFiscalYear() { return $this->db ->select('accounting_periods.*, fiscal_years.name fiscal_year_name') ->from('accounting_periods') ->join('fiscal_years', 'fiscal_years.id = accounting_periods.fiscal_year_id') ->order_by('accounting_periods.start_date', 'DESC') ->get() ->result(); } }