Closed sergey-yabloncev closed 3 years ago
I'm not actually sure what your service provider is doing here. That said, there seem to be some alternate solutions here that might solve this for you: https://github.com/laravel/framework/issues/17830
Hello @cviebrock there https://github.com/cviebrock/eloquent-taggable/blob/master/src/Services/TagService.php#L217 you use where by class, but if you use morphMap for Model, in database tag saving with morph name https://i.imgur.com/EUZsXGQ.png instead of namespace class
And if you try use not a namespace class for example with morhmap name $tagService->getAllTags('stores')
you get exception https://i.imgur.com/zhJfp4J.pnt
I'm still not 100% sure what's going on in your case. If you are overloading the Morph model used by Laravel for polymorphic relations, then it's going to overload the Tag
model class used by the package internally. You'd need to find a way to prevent that.
Alternatively, if you can find a way to do it (by changing the logic in the getAllTags
method), then please submit a PR and I'll update the package.
If add model in service proveder morphMap
Relation::morphMap([ 'model' => Model::class, ]);
MethodsModel::allTags()
and$tagService->getAllTags(\App\Model);
not find tags