class Illuminate / Database / Eloquent / Factories / BelongsToRelationship

BelongsToRelationship

Properties

protected

$factory Illuminate\...\Factory|Model

The related factory instance.

Default: null
protected

$relationship string

The relationship name.

Default: null
protected

$resolved mixed

The cached, resolved parent instance ID.

Default: null

Methods

public

__construct ( $factory , $relationship ) : void

Create a new "belongs to" relationship definition.

Parameters

  • $factory Illuminate\...\Factory|Model
  • $relationship string
public

attributesFor ( Model $model ) : array

Get the parent model attributes and resolvers for the given child model.

Parameters

protected

resolver ( $key ) : Closure

Get the deferred resolver for this relationship's parent ID.

Parameters

  • $key string|null
public

recycle ( $recycle ) : $this

Specify the model instances to always use when creating relationships.

Parameters

  • $recycle Illuminate\...\Collection