diff --git a/src/Database/Model.php b/src/Database/Model.php index 2add8b610..cd8cd1a24 100644 --- a/src/Database/Model.php +++ b/src/Database/Model.php @@ -49,6 +49,11 @@ class Model extends EloquentModel */ public $duplicateCache = true; + /** + * @var bool Indicates if all string model attributes will be trimmed prior to saving. + */ + public $trimStringAttributes = true; + /** * @var array The array of models booted events. */ @@ -1239,7 +1244,7 @@ public function setAttribute($key, $value) /* * Trim strings */ - if (is_string($value)) { + if ($this->trimStringAttributes && is_string($value)) { $value = trim($value); }