Move incident icon to presenter
This commit is contained in:
@@ -84,27 +84,6 @@ class Incident extends Model implements TransformableInterface, PresenterInterfa
|
|||||||
return $statuses[$this->status];
|
return $statuses[$this->status];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds the icon to use for each status.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getIconAttribute()
|
|
||||||
{
|
|
||||||
switch ($this->status) {
|
|
||||||
case 1:
|
|
||||||
return 'icon ion-flag';
|
|
||||||
case 2:
|
|
||||||
return 'icon ion-alert';
|
|
||||||
case 3:
|
|
||||||
return 'icon ion-eye';
|
|
||||||
case 4:
|
|
||||||
return 'icon ion-checkmark';
|
|
||||||
default:
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the transformer instance.
|
* Get the transformer instance.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -71,4 +71,25 @@ class IncidentPresenter extends BasePresenter
|
|||||||
{
|
{
|
||||||
return $this->resource->created_at->setTimezone($this->tz)->toISO8601String();
|
return $this->resource->created_at->setTimezone($this->tz)->toISO8601String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Present the status with an icon.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function icon()
|
||||||
|
{
|
||||||
|
switch ($this->resource->status) {
|
||||||
|
case 1:
|
||||||
|
return 'icon ion-flag';
|
||||||
|
case 2:
|
||||||
|
return 'icon ion-alert';
|
||||||
|
case 3:
|
||||||
|
return 'icon ion-eye';
|
||||||
|
case 4:
|
||||||
|
return 'icon ion-checkmark';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user