ModelIdentifier
class ModelIdentifier
NOTE: Do not use constructor property promotion here.
The order these properties are declared in is part of the serialized output, and Laravel expects that exact order. If this class is switched to constructor property promotion, PHP will change the property declaration order and the serialized string will no longer match Laravel.
Keep these properties explicitly declared in this exact order: class, id, relations, connection, collectionClass.
Properties
| static protected bool | $useMorphMap | Use the Relation morphMap for a Model's name when serializing. |
|
| string|null | $class | The class name of the model, or its morph-map alias when enabled. |
|
| mixed | $id | The unique identifier of the model. |
|
| array<int, string> | $relations | The relationships loaded on the model. |
|
| string|null | $connection | The connection name of the model. |
|
| null|Collection> | $collectionClass | The class name of the model collection. |
Methods
Create a new model identifier.
Specify the collection class that should be used when serializing / restoring collections.
Get the fully-qualified class name of the Model.
Indicate whether to use the relational morph-map when serializing Models.
Flush all static state.
Details
at line 66
__construct(string|null $class, mixed $id, array $relations, string|null $connection = null)
Create a new model identifier.
at line 83
ModelIdentifier
useCollectionClass(string|null $collectionClass)
Specify the collection class that should be used when serializing / restoring collections.
at line 93
string|null
getClass()
Get the fully-qualified class name of the Model.
at line 108
static void
useMorphMap(bool $useMorphMap = true)
Indicate whether to use the relational morph-map when serializing Models.
Boot-only. The flag persists in a static property for the worker lifetime and applies to every model identifier serialization across all coroutines.
at line 116
static void
flushState()
Flush all static state.