HasUniqueStringIds
trait HasUniqueStringIds
Methods
string
newUniqueId()
Generate a new unique key for the model.
bool
isValidUniqueId(mixed $value)
Determine if given key is valid.
void
initializeHasUniqueStringIds()
Initialize the trait.
array
uniqueIds()
Get the columns that should receive a unique identifier.
resolveRouteBindingQuery(Model|Builder|Relation $query, mixed $value, string|null $field = null)
Retrieve the model for a bound value.
string
getKeyType()
Get the auto-incrementing key type.
bool
getIncrementing()
Get the value indicating whether the IDs are incrementing.
never
handleInvalidUniqueId(mixed $value, string|null $field)
Throw an exception for the given invalid unique ID.
Details
at line 17
abstract string
newUniqueId()
Generate a new unique key for the model.
at line 22
abstract protected bool
isValidUniqueId(mixed $value)
Determine if given key is valid.
at line 27
void
initializeHasUniqueStringIds()
Initialize the trait.
at line 37
array
uniqueIds()
Get the columns that should receive a unique identifier.
at line 50
Builder|Relation
resolveRouteBindingQuery(Model|Builder|Relation $query, mixed $value, string|null $field = null)
Retrieve the model for a bound value.
at line 66
string
getKeyType()
Get the auto-incrementing key type.
at line 78
bool
getIncrementing()
Get the value indicating whether the IDs are incrementing.
at line 92
protected never
handleInvalidUniqueId(mixed $value, string|null $field)
Throw an exception for the given invalid unique ID.