public function attach($id, $type = 'page', $toTag = null) { $class = elements($type); $object = $class::find($id); if (!empty($toTag)) { $this->entity = \Veer\Models\Tag::find($id); } if (is_object($object) && is_object($this->entity)) { $object->tags()->attach($this->entity->id); } return $this; }
/** * Delete Tag * */ protected function deleteTag($id) { $t = \Veer\Models\Tag::find($id); if (is_object($t)) { $t->pages()->detach(); $t->products()->detach(); $t->delete(); return true; } return false; }