public function deleteItemAction($tag, Taggables $taggable) { /** @var Files $file */ $file = $taggable->getTagged(); $file->deleteTag($taggable); return $this->redirectByRoute(['for' => 'tags.show', 'tag' => $tag]); }
public function addComment($event, Taggables $taggable) { $tagged = $taggable->getTagged(); if (property_exists($tagged, 'commentCount')) { $tagged->increaseCount('commentCount'); } $taggable->tag()->save(); //刷新一下时间戳updated_at }