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

laravel-enso/NullableFields

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.