Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
4c30c451
Unverified
Commit
4c30c451
authored
Apr 20, 2018
by
Nicolas Widart
Committed by
GitHub
Apr 20, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #518 from Fisiu/allow_empty_tags
Set tags only if passed any.
parents
22ccee98
52d278af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
TaggableTraitTest.php
Modules/Tag/Tests/Integration/TaggableTraitTest.php
+11
-0
TaggableTrait.php
Modules/Tag/Traits/TaggableTrait.php
+4
-0
No files found.
Modules/Tag/Tests/Integration/TaggableTraitTest.php
View file @
4c30c451
...
...
@@ -153,6 +153,17 @@ class TaggableTraitTest extends BaseTestCase
$this
->
assertCount
(
1
,
Page
::
whereTag
([
'한글-태그'
])
->
get
());
}
/** @test */
public
function
it_creates_page_without_tags
()
{
$this
->
createPage
([
'original tag'
]);
$page
=
$this
->
page
->
find
(
1
);
$page
->
setTags
(
null
);
$this
->
assertEmpty
(
Page
::
first
()
->
tags
->
count
());
}
private
function
createPage
(
array
$tags
=
[])
{
return
$this
->
page
->
create
([
...
...
Modules/Tag/Traits/TaggableTrait.php
View file @
4c30c451
...
...
@@ -97,6 +97,10 @@ trait TaggableTrait
*/
public
function
setTags
(
$tags
,
$type
=
'slug'
)
{
if
(
empty
(
$tags
))
{
$tags
=
[];
}
// Get the current entity tags
$entityTags
=
$this
->
tags
->
pluck
(
$type
)
->
all
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment