Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Aug 24, 2018
1 parent ab434af commit 1c59d3d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ class Tags extends Field
protected function fillAttributeFromRequest(NovaRequest $request, $requestAttribute, $model, $attribute)
{
$requestValue = $request[$requestAttribute];

$tagNames = explode(',', $requestValue);
$tagNames = array_filter($tagNames);

$class = get_class($model);

$model->syncTags($tagNames);
$class::saved(function($model) use ($tagNames) {
$model->syncTags($tagNames);
});
}

public function resolveAttribute($resource, $attribute = null)
Expand Down

0 comments on commit 1c59d3d

Please sign in to comment.