Sluggable behaviour - How can I use conditions?

Hi Gal/Guys,

I need some help with sluggable behaviour in Yii2. I am trying to create slugs for articles which are published and if the article is saved as draft the slug should be kept as null.

I tried creating my own function but it created -1,-2,-3 etc as I need the slug with the following parameters

[

‘ensureUnique’=>true,

‘immutable’=>true,

]

if someone can help me it will be great.

Thank you in advance.

Wenceslaus Dsilva

*** BUMP ***