Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make convertToTags() method $values arg support Tag instance #371

Merged
merged 2 commits into from
Nov 22, 2021
Merged

Make convertToTags() method $values arg support Tag instance #371

merged 2 commits into from
Nov 22, 2021

Conversation

chuoke
Copy link
Contributor

@chuoke chuoke commented Nov 20, 2021

Just as scopeWithAllTags() method, it's $tags arg can be Tag instance. But if we use Tag instance, convertToTags() method will go wrong, because collect function will convert Tag to array, and will query each attribute value for Tag. That is wrong.

For simplicity, I think we can handle it this way.

Just as ` scopeWithAllTags() ` method, it's ` $tags ` arg can be `Tag` instance. But if we use Tag instance, `convertToTags` will go wrong, because ` collect ` function will convert `Tag` to array, and will create all attribute value as Tag. That is wrong.
@freekmurze
Copy link
Member

Could you add a test for this?

@chuoke
Copy link
Contributor Author

chuoke commented Nov 21, 2021

@freekmurze No, but I test in my project.
I'll add test for this.

@freekmurze freekmurze merged commit dd6f072 into spatie:main Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants