protected function validateSlug($slug, array $config, $attribute)
{
$separator = $config['separator'];
$reserved = $config['reserved'];
if ($reserved === null) {
return $slug;
}
// check for reserved names
if ($reserved instanceof \Closure) {
$reserved = $reserved($this->model);
}
if (is_array($reserved)) {
if (in_array($slug, $reserved)) {
return $slug . $separator . '1';
}
return $slug;
}
throw new \UnexpectedValueException('Sluggable "reserved" for ' . get_class($this->model) . ':' . $attribute . ' is not null, an array, or a closure that returns null/array.');
}