class AliasModel extends UrlModel implements NamedModel

A Model that has a URL and an alias

Methods

string
getName()

Get the name of the object

string
getEscapedName()

Get the name of the team, safe for use in your HTML

setName($name)

Change the object's name

string|int
getAlias()

Get an object's alias

void
setAlias(string $alias)

Set a model's alias

resetAlias()

Reset a model's alias based on its name

string
getURL(string $action = 'show', bool $absolute = false, array $params = array(), boolean $vanity = false)

Get an object's url

static AliasModel
fetchFromAlias(string $alias)

Gets an entity from the supplied alias

static Model
fetchFromSlug(string|int $slug)

Gets an entity from the supplied slug, which can either be an alias or an ID

static string|null
generateAlias(string $name, int|null $id = null)

Generate a URL-friendly unique alias for an object name

Details

at line line 31
string getName()

Get the name of the object

Return Value

string

at line line 41
string getEscapedName()

Get the name of the team, safe for use in your HTML

Return Value

string The name of the team

at line line 55
AliasModel setName($name)

Change the object's name

Parameters

$name

Return Value

AliasModel

at line line 67
string|int getAlias()

Get an object's alias

Return Value

string|int The alias (or ID if the alias doesn't exist)

at line line 81
void setAlias(string $alias)

Set a model's alias

Parameters

string $alias The new alias

Return Value

void

at line line 90
AliasModel resetAlias()

Reset a model's alias based on its name

Return Value

AliasModel

at line line 102
string getURL(string $action = 'show', bool $absolute = false, array $params = array(), boolean $vanity = false)

Get an object's url

Parameters

string $action The action to perform (e.g show, list or delete)
bool $absolute Whether to return an absolute URL
array $params Extra parameters to pass to the URL generator
boolean $vanity Whether to force the URL to contain just the alias

Return Value

string A link

at line line 139
static AliasModel fetchFromAlias(string $alias)

Gets an entity from the supplied alias

Parameters

string $alias The object's alias

Return Value

AliasModel

at line line 148
static Model fetchFromSlug(string|int $slug)

Gets an entity from the supplied slug, which can either be an alias or an ID

Parameters

string|int $slug The object's slug

Return Value

Model

at line line 166
static string|null generateAlias(string $name, int|null $id = null)

Generate a URL-friendly unique alias for an object name

Parameters

string $name The original object name
int|null $id The ID of the object, if it's being edited and not created

Return Value

string|null The generated alias, or Null if we couldn't make one