Extracted animated property to trait

This commit is contained in:
Andrés Santibáñez
2020-11-03 07:10:30 -05:00
parent 71e2168b6c
commit 5e7cabfd16
5 changed files with 43 additions and 42 deletions

View File

@@ -9,12 +9,14 @@ namespace Asantibanez\LivewireCharts\Models;
*/
class BaseChartModel
{
use HasAnimation;
use HasAxis;
use HasStroke;
use HasLegend;
public function __construct()
{
$this->initAnimation();
$this->initAxis();
$this->initStroke();
$this->initLegend();
@@ -28,6 +30,7 @@ class BaseChartModel
public function toArray()
{
return array_merge(
$this->animationToArray(),
$this->axisToArray(),
$this->strokeToArray(),
$this->legendToArray()
@@ -36,6 +39,7 @@ class BaseChartModel
public function fromArray($array)
{
$this->animationFromArray($array);
$this->axisFromArray($array);
$this->strokeFromArray($array);
$this->legendFromArray($array);