protected function getExistingSlug($slug, $excludeSelf = false)
    {
        $existing = static::where('slug', "$slug");

        if (isset($this->isSlugToggled) && $this->isSlugToggled == true) {
            $existing->where('is_sluggable', true);
        }

        if ($excludeSelf) {
            $existing->where('id', '!=', $this->id);
        }

        return $existing->first() ? true : false;
    }
protected function getExistingSlug($slug, $excludeSelf = false)
    {
        $existing = static::where('slug', "$slug");

        if (isset($this->isSlugToggled) && $this->isSlugToggled == true) {
            $existing->where('is_sluggable', true);
        }

        if ($excludeSelf) {
            $existing->where('id', '!=', $this->id);
        }

        return $existing->first() ? true : false;
    }
protected function getExistingSlug ( $ slug , $ excludeSelf = false ) { $ existing = static :: where ( 'slug' , "$slug" ) ; if ( isset ( $ this -> isSlugToggled ) && $ this -> isSlugToggled == true ) { $ existing -> where ( 'is_sluggable' , true ) ; } if ( $ excludeSelf ) { $ existing -> where ( 'id' , '!=' , $ this -> id ) ; } return $ existing -> first ( ) ? true : false ; }
Checks where slug is currently being used.

@param string $slug
@param        $excludeSelf

@return bool
Checks where slug is currently being used .