Skip to content

Commit

Permalink
Merge branch 'release/4.1.23'
Browse files Browse the repository at this point in the history
* release/4.1.23:
  updated the changelog
  fixed the removal of all topics and tags from a post
  • Loading branch information
austintoddj committed Apr 5, 2019
2 parents d85415d + 582db65 commit 411cd5f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes

## [v4.1.23](https://github.com/cnvs/canvas/compare/v4.1.22...v4.1.23)

### Fixed
- Fixed the removal of all topics and tags from a post ([e83930f](https://github.com/cnvs/canvas/commit/e83930f7e6b62e70e8d66af3601f56dc21200e1a))

## [v4.1.22](https://github.com/cnvs/canvas/compare/v4.1.21...v4.1.22)

### Changed
Expand Down
36 changes: 14 additions & 22 deletions src/Http/Controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,13 @@ public function store()
$post->meta = $data['meta'];
$post->save();

if (! is_null(request('tags'))) {
$post->tags()->sync(
$this->collectTags(request('tags') ?? [])
);
}

if (! is_null(request('topic'))) {
$post->topic()->sync(
$this->assignTopics([request('topic')] ?? [])
);
}
$post->tags()->sync(
$this->collectTags(request('tags') ?? [])
);

$post->topic()->sync(
$this->assignTopics(request('topic') ? [request('topic')] : [])
);

return redirect(route('canvas.post.edit', $post->id))->with('notify', 'Saved!');
}
Expand Down Expand Up @@ -155,17 +151,13 @@ public function update(string $id)
$post->meta = $data['meta'];
$post->save();

if (! is_null(request('tags'))) {
$post->tags()->sync(
$this->collectTags(request('tags') ?? [])
);
}

if (! is_null(request('topic'))) {
$post->topic()->sync(
$this->assignTopics([request('topic')] ?? [])
);
}
$post->tags()->sync(
$this->collectTags(request('tags') ?? [])
);

$post->topic()->sync(
$this->assignTopics(request('topic') ? [request('topic')] : [])
);

return redirect(route('canvas.post.edit', $post->id))->with('notify', 'Saved!');
}
Expand Down

0 comments on commit 411cd5f

Please sign in to comment.