class
Illuminate
/
Database
/
Eloquent
/
Factories
/
Relationship
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.
Relationship
Properties
protected
$factory Illuminate\...\Factory
The related factory instance.
Default: null
protected
$relationship string
The relationship name.
Default: null
Methods
public
__construct ( Illuminate\...\Factory $factory , $relationship ) : void
Create a new child relationship instance.
Parameters
- $factory Illuminate\...\Factory
- $relationship string
public
createFor ( Model $parent ) : void
Create the child relationship for the given parent model.
Parameters
- $parent Model
public
recycle ( $recycle ) : $this
Specify the model instances to always use when creating relationships.
Parameters
- $recycle Illuminate\...\Collection