/**
  * Get all existing slugs that are similar to the given slug.
  *
  * @param string $slug
  * @param string $attribute
  * @param array $config
  * @return \Illuminate\Support\Collection
  */
 protected function getExistingSlugs($slug, $attribute, array $config)
 {
     $includeTrashed = $config['includeTrashed'];
     $query = $this->model->newQuery()->findSimilarSlugs($this->model, $attribute, $config, $slug);
     // use the model scope to find similar slugs
     if (method_exists($this->model, 'scopeWithUniqueSlugConstraints')) {
         $query->withUniqueSlugConstraints($this->model, $attribute, $config, $slug);
     }
     // include trashed models if required
     if ($includeTrashed && $this->usesSoftDeleting()) {
         $query->withTrashed();
     }
     // get the list of all matching slugs
     return $query->pluck($attribute, $this->model->getKeyName());
 }
 /**
  * Unguard eloquent model if needed.
  */
 protected function unguardIfNeeded()
 {
     if ($this->unguard) {
         $this->model->unguard();
     }
 }