Namespaced traits

This commit is contained in:
asantibanez
2024-08-22 12:56:14 -05:00
parent 343ebbaeee
commit 3014bb1ab3
12 changed files with 39 additions and 27 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace Asantibanez\LivewireCharts\Models\Traits;
trait HasTitle
{
private $title;
public function setTitle($title)
{
$this->title = $title;
return $this;
}
protected function initTitle()
{
$this->title = $this->defaultTitle();
}
private function defaultTitle()
{
return '';
}
protected function titleFromArray($array)
{
$this->title = data_get($array, 'title', $this->defaultTitle());
}
protected function titleToArray()
{
return [
'title' => $this->title,
];
}
}