protected function generateSlugOnUpdate()
    {
        $this->slugOptions = $this->getSlugOptions();

        if (!$this->slugOptions->generateSlugOnUpdate) {
            return;
        }

        // check updating
        $slugNew = $this->generateNonUniqueSlug();
        $slugCurrent = $this->attributes[$this->slugOptions->slugField];

        // if new base slug is in string as old slug (the slug source's value did not change)
        // see if the slug is still unique in database
        if (strpos($slugCurrent, $slugNew) === 0) {
            $slugUpdate = $this->checkUpdatingSlug($slugCurrent);
            // no need to update slug (slug is still unique)
            if ($slugUpdate !== false) {
                return;
            }
        }

        $this->createSlug();
    }
protected function generateSlugOnUpdate()
    {
        $this->slugOptions = $this->getSlugOptions();

        if (!$this->slugOptions->generateSlugOnUpdate) {
            return;
        }

        // check updating
        $slugNew = $this->generateNonUniqueSlug();
        $slugCurrent = $this->attributes[$this->slugOptions->slugField];

        // if new base slug is in string as old slug (the slug source's value did not change)
        // see if the slug is still unique in database
        if (strpos($slugCurrent, $slugNew) === 0) {
            $slugUpdate = $this->checkUpdatingSlug($slugCurrent);
            // no need to update slug (slug is still unique)
            if ($slugUpdate !== false) {
                return;
            }
        }

        $this->createSlug();
    }
protected function generateSlugOnUpdate ( ) { $ this -> slugOptions = $ this -> getSlugOptions ( ) ; if ( ! $ this -> slugOptions -> generateSlugOnUpdate ) { return ; } // check updating $ slugNew = $ this -> generateNonUniqueSlug ( ) ; $ slugCurrent = $ this -> attributes [ $ this -> slugOptions -> slugField ] ; // if new base slug is in string as old slug (the slug source's value did not change) // see if the slug is still unique in database if ( strpos ( $ slugCurrent , $ slugNew ) === 0 ) { $ slugUpdate = $ this -> checkUpdatingSlug ( $ slugCurrent ) ; // no need to update slug (slug is still unique) if ( $ slugUpdate !== false ) { return ; } } $ this -> createSlug ( ) ; }
Handle adding slug on model update.
Handle adding slug on model update .