/** * Update Tags for a specific Item * * @param Item $item * @param array $inputs * @param User $user */ public function updateForItem(Item $item, $inputs, $user) { // Clear out existing Tags $item->tags()->detach(); // If no tags were included, they are clearing out all tags for the item, so just return if (empty($inputs['tags'])) { return; } // Save Tags $tags = $this->store($inputs, $user); // Attach Tags to the Item $item->tags()->attach($tags); return; }