/** * Custom save method. */ public function save() { // Set completed date if ($this->status != 1 and $this->completed_at == null) { $this->is_locked = true; $this->completed_at = new DateTime(); $this->isBeingCompleted = true; } elseif ($this->status == 1) { $this->is_locked = false; $this->completed_at = null; } if (parent::save()) { return true; } return false; }