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

TaggedToMany Relationship #514

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open

TaggedToMany Relationship #514

wants to merge 34 commits into from

Conversation

edstevo
Copy link

@edstevo edstevo commented Sep 18, 2024

Hi,

This is my first PR, so please bear with me if I've got anything wrong!

I'm using this in my project where I wanted to have a relationship between models using shared tags. Essentially, I want to categorise products by tags, where ProductCategory models share tags with Product models.

I've added testing, which passes. Hopefully all is covered.

Thank you

dependabot bot and others added 22 commits April 29, 2024 16:49
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.6.0 to 2.1.0.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](dependabot/fetch-metadata@v1.6.0...v2.1.0)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
…t differentiate between tags not using type in any case.
Fixed links to documentation pages
…ependabot/fetch-metadata-2.1.0

Bump dependabot/fetch-metadata from 1.6.0 to 2.1.0
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](dependabot/fetch-metadata@v2.1.0...v2.2.0)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
…ependabot/fetch-metadata-2.2.0

Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0
Added support for translation via JSON fields for PostgreSQL
bugfix: fixes the syncWithType method to avoid deleting tags without …
@AlexVanderbist
Copy link
Member

Hi @edstevo, thanks for your work on this PR! Could you please make sure the tests in the GitHub actions for this PR are all passing? Additionally, could you please add some documentation on how to use this feature in the docs of this repository? Thanks!

@AlexVanderbist AlexVanderbist marked this pull request as draft October 3, 2024 15:30
AlexVanderbist and others added 5 commits October 3, 2024 17:43
…/using-tags.md`

* **README.md**
  - Add a section to document the `hasTag` method
  - Include examples of how to use the `hasTag` method

* **docs/basic-usage/using-tags.md**
  - Add a section to document the `hasTag` method
  - Include examples of how to use the `hasTag` method
Add "hasTag" method to check if the model has a certain tag
@edstevo edstevo marked this pull request as ready for review October 3, 2024 17:29
@edstevo
Copy link
Author

edstevo commented Oct 3, 2024

Hi @AlexVanderbist. Think this is all done now.

Copy link

@xalunda xalunda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using hard coded taggables table name will break app with custom table name.

})
->join(
$tagModel->getTable(),
'taggables.tag_id',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break custom taggables table names

{
$this->query->select($this->related->getTable() . ".*")
->join(
"taggables as taggables_related",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for all this file, this will break custom taggables table names

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.

9 participants