yii\behaviors\SluggableBehavior::validateSlug PHP Method

validateSlug() protected method

Checks if given slug value is unique.
protected validateSlug ( string $slug ) : boolean
$slug string slug value
return boolean whether slug is unique.
    protected function validateSlug($slug)
    {
        /* @var $validator UniqueValidator */
        /* @var $model BaseActiveRecord */
        $validator = Yii::createObject(array_merge(['class' => UniqueValidator::className()], $this->uniqueValidator));
        $model = clone $this->owner;
        $model->clearErrors();
        $model->{$this->slugAttribute} = $slug;
        $validator->validateAttribute($model, $this->slugAttribute);
        return !$model->hasErrors();
    }