public function checkDates() { if (!empty($this->end_date)) { $start = strtotime($this->start_date); $end = strtotime($this->end_date); if ($end < $start) { $this->addError('end_date', 'End date must be after the start date.'); } } }