Tag syncing is now done within the Component commands

This commit is contained in:
James Brooks
2019-07-12 10:29:23 +01:00
parent 06af61b8c5
commit 6810af48f7
10 changed files with 197 additions and 64 deletions
@@ -56,6 +56,15 @@ class UpdateComponentCommandHandler
$component->update($this->filter($command));
// Sync the tags into the component.
if ($command->tags) {
collect(preg_split('/ ?, ?/', $command->tags))->filter()->map(function ($tag) {
return trim($tag);
})->pipe(function ($tags) use ($component) {
$component->syncTags($tags);
});
}
event(new ComponentWasUpdatedEvent($this->auth->user(), $component));
return $component;