class
Illuminate
/
Database
/
Eloquent
/
Factories
/
BelongsToRelationship
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.
BelongsToRelationship
Properties
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
- $model Model
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