Make sure when a note has no content, null is saved to the db, not ''
This commit is contained in:
parent
56d180729e
commit
ae2dc99069
3 changed files with 8 additions and 1 deletions
|
@ -132,7 +132,11 @@ class Note extends Model
|
|||
*/
|
||||
public function setNoteAttribute($value)
|
||||
{
|
||||
$this->attributes['note'] = normalizer_normalize($value, Normalizer::FORM_C);
|
||||
$normalized = normalizer_normalize($value, Normalizer::FORM_C);
|
||||
if ($normalized === '') { //we don’t want to save empty strings to the db
|
||||
$normalized = null;
|
||||
}
|
||||
$this->attributes['note'] = $normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue