Nullable
Enables nullification of empty values on model attributes.
trait Winter\Storm\Database\Traits\Nullable
A model that uses this class must provide a property $nullable, that defines as an array all columns that will be
set to null if they contain an empty value.
Methods
public
addNullable (array | string | null $attributes = null)
: $this
Adds an attribute to the nullable attributes list
Parameters
| Property | Type | Description |
|---|---|---|
| $attributes | array | string | null |
array | string | null
|
Returns
$this
public static bootNullable () : void
Boot the nullable trait for a model
Returns
void
public checkNullableValue (mixed $value) : bool
Checks if the supplied value is empty, excluding zero.
Parameters
| Property | Type | Description |
|---|---|---|
| $value | mixed |
mixed
Value to check |
Returns
bool
public nullableBeforeSave () : void
Nullify empty fields
Returns
void
Used by
| Class | Description |
|---|---|
DeferredBinding
|
Deferred Binding Model |
← Previous page
Winter\Storm\Database\Traits\NestedTree
Next page →
Winter\Storm\Database\Traits\Purgeable
Copyright © 2025 Winter CMS