You've already forked pilot-sdk
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bdfcba39da | |||
| f38719837e |
@@ -4,9 +4,13 @@ namespace Bluesquare\Pilot\Entity;
|
||||
|
||||
abstract class Entity
|
||||
{
|
||||
public function __construct(protected $slug = null)
|
||||
{
|
||||
protected $slug = null;
|
||||
|
||||
public function __construct($slug = null)
|
||||
{
|
||||
if (! is_null($slug)) {
|
||||
$this->slug = $slug;
|
||||
}
|
||||
}
|
||||
|
||||
public function slug()
|
||||
|
||||
@@ -48,7 +48,7 @@ abstract class Metric extends Widget
|
||||
{
|
||||
$filter = collect($filters)->firstWhere('value', $this->data['filter'] ?? null) ?? collect($filters)->first();
|
||||
|
||||
$computed = is_array($filter) ? $filter['callback']($this->data) : [];
|
||||
$computed = is_array($filter) ? $filter['callback']() : [];
|
||||
|
||||
return [
|
||||
'filter' => $filter['value'],
|
||||
@@ -74,19 +74,18 @@ abstract class Metric extends Widget
|
||||
|
||||
public function progress($current, $target)
|
||||
{
|
||||
return $this->output([
|
||||
return [
|
||||
'type' => 'progress',
|
||||
'value' => $current,
|
||||
'target' => $target,
|
||||
]);
|
||||
];
|
||||
}
|
||||
|
||||
public function trend($value, $previous = null)
|
||||
public function trend($values)
|
||||
{
|
||||
return [
|
||||
'type' => 'trend',
|
||||
'value' => $value,
|
||||
'previous' => $previous,
|
||||
'values' => $values,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -98,11 +97,12 @@ abstract class Metric extends Widget
|
||||
];
|
||||
}
|
||||
|
||||
public function value($value)
|
||||
public function value($value, $previous = null)
|
||||
{
|
||||
return [
|
||||
'type' => 'value',
|
||||
'value' => $value,
|
||||
'previous' => $previous,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user