trait
Illuminate
/
Database
/
Eloquent
/
Relations
/
Concerns
/
SupportsDefaultModels
SupportsDefaultModels
Properties
protected
$withDefault Closure |array|bool
Indicates if a default model instance should be used.
Alternatively, may be a Closure or array.
Default: null
Methods
protected
abstract
newRelatedInstanceFor ( Model $parent ) : Model
Make a new related instance for the given model.
Parameters
- $parent Model
public
withDefault ( $callback ) : $this
Return a new model instance in case the relationship does not exist.
Parameters
- $callback Closure |array|bool