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
$results = $query->select([$attribute, $this->model->getTable() . '.' . $this->model->getKeyName()])->get()->toBase();
// key the results and return
return $results->pluck($attribute, $this->model->getKeyName());
}