Extracted title property to trait

This commit is contained in:
Andrés Santibáñez
2020-11-03 07:20:46 -05:00
parent 22b72c1980
commit 63fe7a1533
6 changed files with 43 additions and 57 deletions

View File

@@ -9,6 +9,7 @@ namespace Asantibanez\LivewireCharts\Models;
*/
class BaseChartModel
{
use HasTitle;
use HasAnimation;
use HasAxis;
use HasStroke;
@@ -16,6 +17,7 @@ class BaseChartModel
public function __construct()
{
$this->initTitle();
$this->initAnimation();
$this->initAxis();
$this->initStroke();
@@ -30,6 +32,7 @@ class BaseChartModel
public function toArray()
{
return array_merge(
$this->titleToArray(),
$this->animationToArray(),
$this->axisToArray(),
$this->strokeToArray(),
@@ -39,6 +42,7 @@ class BaseChartModel
public function fromArray($array)
{
$this->titleFromArray($array);
$this->animationFromArray($array);
$this->axisFromArray($array);
$this->strokeFromArray($array);