Only search on the slug column.

The orWhere statement caused tags not to be found. Fixed issue when having an entity with 3 tags, updating it with 0 tags, remove all 3 links. This wasn't the case before.
parent 969a1477
...@@ -181,8 +181,7 @@ trait TaggableTrait ...@@ -181,8 +181,7 @@ trait TaggableTrait
->where('namespace', $this->getEntityClassName()) ->where('namespace', $this->getEntityClassName())
->with('translations') ->with('translations')
->whereHas('translations', function (Builder $q) use ($name) { ->whereHas('translations', function (Builder $q) use ($name) {
$q->orWhere('name', $this->generateTagSlug($name)); $q->where('slug', $this->generateTagSlug($name));
$q->orWhere('slug', $this->generateTagSlug($name));
})->first(); })->first();
if ($tag) { if ($tag) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment