class BelongsToRelationship (View source)
| protected Factory|Model | $factory | The related factory instance. | |
| protected string | $relationship | The relationship name. | |
| protected mixed | $resolved | The cached, resolved parent instance ID. |
| void | __construct(Factory|Model $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(string|null $key)
Get the deferred resolver for this relationship's parent ID. | |
| $this | recycle(Collection $recycle)
Specify the model instances to always use when creating relationships. |
Create a new "belongs to" relationship definition.
Get the parent model attributes and resolvers for the given child model.
Get the deferred resolver for this relationship's parent ID.
Specify the model instances to always use when creating relationships.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Database/Eloquent/Factories/BelongsToRelationship.html