S
S
SlimSavernake2017-03-03 05:17:12
Yii
SlimSavernake, 2017-03-03 05:17:12

How to show related posts in creocoder/yii2-taggable?

I use https://github.com/creocoder/yii2-taggable for tags

Article::find()
                    ->relatedByTagValues('Транспорт, Дорога')
                    ->limit(5)
                    ->all(),

This code shows me the posts with the most tags. Any. And I need to show records that also have the tags "Transport" and "road". Or at least only with "transport" or only with "road".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2017-03-03
@SlimSavernake

So it is still written how to use
Search entities by any tags
To search entities by any tags

// through string
$posts = Post::find()->anyTagValues('foo, bar')->all();

// through array
$posts = Post::find()->anyTagValues(['foo', 'bar'])->all();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question