SupportsDefaultModels
trait SupportsDefaultModels (View source)
Properties
| protected Closure|array|bool | $withDefault | Indicates if a default model instance should be used. |
Methods
$this
withDefault(Closure|array|bool $callback = true)
Return a new model instance in case the relationship does not exist.
Model|null
Details
abstract protected 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.
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.