W3cubDocs

/Laravel 8

BelongsToRelationship

class BelongsToRelationship (View source)

Properties

protected Factory $factory The related factory instance.
protected string $relationship The relationship name.
protected mixed $resolved The cached, resolved parent instance ID.

Methods

void __construct(Factory $factory, string $relationship)

Create a new "belongs to" relationship definition.

array attributesFor(Model $model)

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

Closure resolver()

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

Details

void __construct(Factory $factory, string $relationship)

Create a new "belongs to" relationship definition.

Parameters

Factory $factory
string $relationship

Return Value

void

array attributesFor(Model $model)

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

Parameters

Model $model

Return Value

array

protected Closure resolver()

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

Return Value

Closure

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Database/Eloquent/Factories/BelongsToRelationship.html