Skip to content
This repository has been archived by the owner on Jun 3, 2018. It is now read-only.

Latest commit

 

History

History
26 lines (18 loc) · 1.17 KB

README.md

File metadata and controls

26 lines (18 loc) · 1.17 KB

NullableFileds

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.