class ModelIdentifier (View source)

Properties

static protected bool $useMorphMap

Use the Relation morphMap for a Model's name when serializing.

Model>|string|null $class

The class name of the model.

mixed $id

The unique identifier of the model.

array $relations

The relationships loaded on the model.

string|null $connection

The connection name of the model.

Collection>|null $collectionClass

The class name of the model collection.

Methods

__construct(Model>|null $class, mixed $id, array $relations, mixed $connection)

Create a new model identifier.

$this
useCollectionClass(string|null $collectionClass)

Specify the collection class that should be used when serializing / restoring collections.

string|null
getClass()

Get the fully-qualified class name of the Model.

static void
useMorphMap(bool $useMorphMap = true)

Indicate whether to use the relational morph-map when serializing Models.

Details

__construct(Model>|null $class, mixed $id, array $relations, mixed $connection)

Create a new model identifier.

Parameters

Model>|null $class
mixed $id
array $relations
mixed $connection

$this useCollectionClass(string|null $collectionClass)

Specify the collection class that should be used when serializing / restoring collections.

Parameters

string|null $collectionClass

Return Value

$this

string|null getClass()

Get the fully-qualified class name of the Model.

Return Value

string|null

static void useMorphMap(bool $useMorphMap = true)

Indicate whether to use the relational morph-map when serializing Models.

Parameters

bool $useMorphMap

Return Value

void

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.