Problem with using custom tag model or custom Tag table name #495
Unanswered
kamil-stellis
asked this question in
Q&A
Replies: 1 comment
-
I submitted a PR that should solve this issue: #529 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
I have a need to use spatie/laravel-tags with table names prefixed by 'api_'. I have created custom Tag model and configured table_name
I have configured config/tags.php to use my model, and use different taggable table_name: api_taggable. Most of functions worked as intended, by i hade problems invoking query:
$query->withAllTags(["tags"]);
It turned out that scopeWithAllTags is using static
tags.id
condition:Exception
It caused exception:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tags.id' in 'where clause'
Solution
I think the solution is to use configured tags table name as given below:
Beta Was this translation helpful? Give feedback.
All reactions