laravel-enso/nullablefields

This package is abandoned and no longer maintained. No replacement package was suggested.

Trait for nullable fields

1.0.5 2017-06-13 07:28 UTC

This package is not auto-updated.

Last update: 2019-05-17 14:14:47 UTC


README

Codacy Badge StyleCI Total Downloads Latest Stable Version

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

  1. 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.