final class ModelMetadata
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Reads source-declared model metadata without loading model or framework code.

Constants§

public const MODEL = 'Illuminate\Database\Eloquent\Model'

The framework contract identified by model.

public const BUILDER = 'Illuminate\Database\Eloquent\Builder'

The framework contract identified by builder.

public const SOFT_DELETES = 'Illuminate\Database\Eloquent\SoftDeletes'

The framework contract identified by soft_deletes.

Methods§

public function __construct(private ProgramIndex $index)

Configures the source metadata and SQL grammar used by this model.

Parameters

public function guard(string $className, QueryState $state): QueryState

Model hooks and custom builders cannot be silently treated as standard behavior.

Parameters

$classNamestring
$stateQueryState

Returns

Test cases 1
Called from 1
Calls 5
public function guardDefaults(ClassShape $shape, QueryState $state): QueryState

Rejects unresolved defaults and implicit additional queries.

Parameters

Returns

Test cases 1
Called from 1
Calls 5
public function constant(string $className, string $constant): string|int|float|bool|null

A scalar model constant, such as DELETED_AT.

Parameters

$classNamestring
$constantstring

Returns

string|int|float|bool|null
Test cases 1
Called from 1
Calls 2
public function scalar(Expr $expression): string|int|float|bool|null

A literal default; arbitrary expressions are left unresolved.

Parameters

$expressionExpr

Returns

string|int|float|bool|null
Test cases 1
Called from 3
Calls 3
  • method-call ConstExprEvaluator::evaluateDirectly() line 172
  • new ConstExprEvaluator line 172
  • function-call is_scalar line 174
public function conventionalTable(string $className): ?string

Common unambiguous English conventions; other inflections require an explicit table.

Parameters

$classNamestring

Returns

?string
Test cases 1
Called from 1
Calls 5

Private surface 1§

Implementation details, listed for orientation only.

private ProgramIndex $index

Test cases 16§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 11
Other tests reaching this symbol 5

Relations§

Instantiated in 4
Method calls 4
Constant reads 5