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 Description
$attributes
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 Description
$value
mixed

Value to check

Returns
bool

public nullableBeforeSave () : void

Nullify empty fields

Returns
void

Used by

Class Description
DeferredBinding

Deferred Binding Model

Copyright © 2024 Winter CMS