*/ abstract class HasOneOrMany extends Relation { /** * Create a new has one or many relationship instance. * * @param \Illuminate\Database\Eloquent\Builder $query * @param TRelatedModel $parent * @param non-empty-string $foreignKey * @param non-empty-string $localKey * @return void */ public function __construct(\Illuminate\Database\Eloquent\Builder $query, \Illuminate\Database\Eloquent\Model $parent, $foreignKey, $localKey); /** * @param array, mixed> $attributes * @phpstan-return TRelatedModel */ public function make(array $attributes = []); /** * Find a model by its primary key or return new instance of the related model. * * @param mixed $id * @param array $columns * @return \Illuminate\Support\Collection|TRelatedModel */ public function findOrNew($id, $columns = ['*']); /** * Get the first related model record matching the attributes or instantiate it. * * @param array, mixed> $attributes * @param array $values * @return TRelatedModel */ public function firstOrNew(array $attributes, array $values = []); /** * Get the first related record matching the attributes or create it. * * @param array, mixed> $attributes * @param array $values * @return TRelatedModel */ public function firstOrCreate(array $attributes, array $values = []); /** * Create or update a related record matching the attributes, and fill it with values. * * @param array, mixed> $attributes * @param array $values * @return TRelatedModel */ public function updateOrCreate(array $attributes, array $values = []); /** * Attach a model instance to the parent model. * * @param \Illuminate\Database\Eloquent\Model $model * @return TRelatedModel|false */ public function save(\Illuminate\Database\Eloquent\Model $model); /** * @phpstan-param array, mixed> $attributes * * @phpstan-return TRelatedModel */ public function create(array $attributes = []); /** * Create a Collection of new instances of the related model. * * @param iterable $records * @return \Illuminate\Database\Eloquent\Collection */ public function createMany(iterable $records); }