laravel-enso / nullablefields
Trait for nullable fields
Installs: 117
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:trait
Requires
- php: >=5.6.4
- laravel/framework: 5.4.*
This package is not auto-updated.
Last update: 2022-02-01 13:06:16 UTC
README
Trait for nullable fields heavily inspired from michaeldyrynda/laravel-nullable-fields package.
Usefull only with Laravel <= 5.3. L5.4 comes with TrimStrings
and ConvertEmptyStringsToNull
by default.
Use
- In the Model where you want empty strings to be set to null add
use LaravelEnso\NullableFileds\app\Traits\NullableFileds
then set the attribute that shold be transformed:
protected $nullableFields = ['attribute', ...]
Note
The laravel-enso/core package comes with this library included.