/** * @param SiteModelInterface $site * * @return $this */ public function makeDefault(SiteModelInterface $site) { if (!$site->isDefault()) { $this->model->where(Model::ATTR_ID, '!=', $site->getId())->update([Model::ATTR_DEFAULT => false]); $site->setDefault(true); $this->save($site); } return $this; }