/** * @param $identifier * @param array $attributes Update attributes * @return \stdClass Updated project model */ public function update($identifier, array $attributes) { $model = $this->getByHash($identifier); if ($attributes['status'] == 1) { //ignore submission if already submitted. For the case where state returns to status 1 if ($model->submitted_at != null) { unset($attributes['submitted_at']); } } else { if ($attributes['status'] == 2) { //ignore review if already reviewed. For the case where the state returns to status 2 if ($model->reviewed_on != null) { unset($attributes['reviewed_on']); } } } $updated = parent::update($model->id, $attributes); return $updated; }