trait SupportsDefaultModels (View source)
protected Closure|array|bool | $withDefault | Indicates if a default model instance should be used. |
Model | newRelatedInstanceFor(Model $parent) Make a new related instance for the given model. | |
$this | withDefault(Closure|array|bool $callback = true) Return a new model instance in case the relationship does not exist. | |
Model|null | getDefaultFor(Model $parent) Get the default value for this relation. |
Make a new related instance for the given model.
Return a new model instance in case the relationship does not exist.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.8/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.html