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

Using Metadata for Table Relationships in Laravel #99

Open
matuskm opened this issue Feb 5, 2024 · 2 comments
Open

Using Metadata for Table Relationships in Laravel #99

matuskm opened this issue Feb 5, 2024 · 2 comments
Labels

Comments

@matuskm
Copy link

matuskm commented Feb 5, 2024

Is it possible to utilize meta for a relationship with another table? For example, I have a "products" table and metadata where the "key" is "mistake" and the value is "1". So, if I want to retrieve the meta "mistake", then based on the key with "1", I want to retrieve data from the "mistakes" table where mistakes.id=1. Something similar to what Laravel has for hasOne()... Thank you.

@matuskm matuskm changed the title Using Metadata for Table Relationships in Laravel? Using Metadata for Table Relationships in Laravel Feb 5, 2024
@frasmage
Copy link
Collaborator

frasmage commented Feb 5, 2024

By all means. For something high volume, you may find native columns with proper indexing a bit more performant, but for occasional relationships, tables that are difficult to modify or something particularly polymorphic, this approach can work

@matuskm
Copy link
Author

matuskm commented Feb 5, 2024

Can you provide me with an example of how to do it? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants