class ModelHelper

internal  
 

Methods

__construct(DeclarationDependencyTracker $declarationDependencyTracker, ReflectionProvider $reflectionProvider, RuntimeInputs $runtimeInputs)

Create a new model helper instance.

getInstance(ClassReflection $classReflection)

Get the model's instance, created without running its constructor and memoized per class, so callers must treat it as read-only.

Closure|null
getRelationResolver(ClassReflection $classReflection, string $name)

Get the resolver that resolveRelationUsing() registered at boot for the model's relation, without running it.

static Model
newInstanceWithoutConstructor(ClassReflection $classReflection)

Create a model instance without running its constructor.

Details

at line 30
__construct(DeclarationDependencyTracker $declarationDependencyTracker, ReflectionProvider $reflectionProvider, RuntimeInputs $runtimeInputs)

Create a new model helper instance.

Parameters

DeclarationDependencyTracker $declarationDependencyTracker
ReflectionProvider $reflectionProvider
RuntimeInputs $runtimeInputs

at line 47
Model getInstance(ClassReflection $classReflection)

Get the model's instance, created without running its constructor and memoized per class, so callers must treat it as read-only.

What the instance reads, such as its connection, table, key and casts, comes from property defaults and method bodies that are not part of the model's declarations, so their files become dependencies of the files depending on the model.

Parameters

ClassReflection $classReflection

Return Value

Model

Exceptions

ReflectionException

at line 69
Closure|null getRelationResolver(ClassReflection $classReflection, string $name)

Get the resolver that resolveRelationUsing() registered at boot for the model's relation, without running it.

Parameters

ClassReflection $classReflection
string $name

Return Value

Closure|null

Exceptions

ReflectionException

at line 81
static Model newInstanceWithoutConstructor(ClassReflection $classReflection)

Create a model instance without running its constructor.

Parameters

ClassReflection $classReflection

Return Value

Model

Exceptions

ReflectionException