diff --git a/src/Models/HasColors.php b/src/Models/HasColors.php index bfe57b1..13e784d 100644 --- a/src/Models/HasColors.php +++ b/src/Models/HasColors.php @@ -8,6 +8,8 @@ trait HasColors { private $colors; + private $enableShades; + public function setColors($colors) { $this->colors = $colors; @@ -22,9 +24,25 @@ trait HasColors return $this; } + public function enableShades() + { + $this->enableShades = true; + + return $this; + } + + public function disableShades() + { + $this->enableShades = false; + + return $this; + } + protected function initColors() { $this->colors = $this->defaultColors(); + + $this->enableShades = true; } private function defaultColors() @@ -35,12 +53,15 @@ trait HasColors protected function colorsFromArray($array) { $this->colors = data_get($array, 'colors', $this->defaultColors()); + + $this->enableShades = data_get($array, 'enableShades', true); } protected function colorsToArray() { return [ 'colors' => $this->colors, + 'enableShades' => $this->enableShades, ]; } }