spatie / laravel-tags

Add tags and taggable behaviour to your Laravel app

Home Page:https://freek.dev/609-an-opinionated-tagging-package-for-laravel-apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trying to wrap my head around updating tags in REST API

giorgiopagnoni opened this issue · comments

I have a REST API and I'm having a hard time wrapping my head about updating tags for existing entities. I want to get in each PUT request the full list of tags and attach/detach the tags if they aren't/are already attached. How can I go about it?

Es. my entity has tags ["A", "B"] -> PUT request with ["B", "C"] should result in entity with ["B", "C"] only, so detach A and attach/create C. Which methods should I use in my controllers?

Ok, simply syncing is probably enough...