/** * This will override the given model which means it will be deleted * from database... * * @param Model $model */ public function override(Model $model) { if ($model->doesUse('Ordered')) { // Set the order to the same model order $this->setOrder($model->getOrder()); $model->delete(); } }
/** * @param string $key * @return mixed|void */ public function getAttribute($key) { if (!($value = parent::getAttribute($key))) { return $this->getInfo($key); } return $value; }
/** * @param Model $model * @return bool */ public function same(Model $model) { return $model->getClass() == $this->getClass() and $model->id == $this->id; }