BelongsToManyRelationship
class BelongsToManyRelationship (View source)
Properties
| protected Factory|Collection|Model|array | $factory | The related factory instance. |
|
| protected callable|array | $pivot | The pivot attributes / attribute resolver. |
|
| protected string | $relationship | The relationship name. |
Methods
void
__construct(Factory|Collection|Model|array $factory, callable|array $pivot, string $relationship)
Create a new attached relationship definition.
$this
Details
void
__construct(Factory|Collection|Model|array $factory, callable|array $pivot, string $relationship)
Create a new attached relationship definition.
void
createFor(Model $model)
Create the attached relationship for the given model.
$this
recycle(Collection $recycle)
Specify the model instances to always use when creating relationships.
Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.