예제 #1
0
파일: Tag.php 프로젝트: artemsk/veer-core
 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;
 }
예제 #2
0
 /**
  * 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;
 }