class
Illuminate
/
Database
/
Eloquent
/
Factories
/
BelongsToRelationship
You are viewing an older version of the documentation. For the latest, please visit master documentation.
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
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