PermalinkMaker
class PermalinkMaker
Traits
Singleton trait.
Properties
static protected | $instance | from Singleton | |
protected Model | $model |
Methods
Get the permalink configuration for the current model, including default values that where not specified.
Build the slug for the given attribute of the current model.
Determines whether the model needs slugging.
Get the string that should be used as base for the slug.
Generate a slug from the given source string.
Checks if the slug should be unique, and makes it so if needed.
Get all existing slugs that are similar to the given slug.
Checks that the given slug is not a reserved word.
Generate a unique suffix for the given slug (and list of existing, "similar" slugs.
Details
in
Singleton at line 18
final static
instance()
Create a new instance of this singleton.
in
Singleton at line 28
final static
forgetInstance()
Forget this singleton's instance if it exists
in
Singleton at line 36
final protected
__construct()
Constructor.
in
Singleton at line 44
protected
initialize()
Initialize the singleton free from constructor parameters.
in
Singleton at line 48
__clone()
No description
in
Singleton at line 53
__wakeup()
No description
at line 15
slug(Model $model, $force = false)
No description
at line 39
array
getConfiguration(array $overrides = [])
Get the permalink configuration for the current model, including default values that where not specified.
at line 72
null|string
buildSlug(string $attribute, array $config, bool $force = null)
Build the slug for the given attribute of the current model.
at line 98
protected bool
needsSlugging(string $attribute, array $config)
Determines whether the model needs slugging.
at line 118
protected mixed|string
getSlugSource($from)
Get the string that should be used as base for the slug.
at line 146
protected string
generateSlug(string $source, array $config, string $attribute)
Generate a slug from the given source string.
at line 170
protected string
makeSlugUnique(string $slug, array $config, string $attribute)
Checks if the slug should be unique, and makes it so if needed.
at line 211
protected Collection
getExistingSlugs(string $slug, string $attribute, array $config)
Get all existing slugs that are similar to the given slug.
at line 240
protected string
validateSlug(string $slug, array $config, string $attribute)
Checks that the given slug is not a reserved word.
at line 284
protected string
generateSuffix(string $slug, string $separator, Collection $list)
Generate a unique suffix for the given slug (and list of existing, "similar" slugs.
at line 304
setModel(Model $model)
No description