public static function createSlug($model, $attribute, $fromString, array $config = null)
{
if (is_string($model)) {
$model = new $model();
}
$instance = (new self())->setModel($model);
if ($config === null) {
$config = array_get($model->sluggable(), $attribute);
} elseif (!is_array($config)) {
throw new \UnexpectedValueException('SlugService::createSlug expects an array or null as the fourth argument; ' . gettype($config) . ' given.');
}
$config = $instance->getConfiguration($config);
$slug = $instance->generateSlug($fromString, $config, $attribute);
$slug = $instance->validateSlug($slug, $config, $attribute);
$slug = $instance->makeSlugUnique($slug, $config, $attribute);
return $slug;
}