1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Ninja/Presenters/ClientPresenter.php

41 lines
980 B
PHP
Raw Normal View History

2015-11-12 21:36:28 +01:00
<?php namespace App\Ninja\Presenters;
2016-02-25 22:33:48 +01:00
use URL;
2015-11-12 21:36:28 +01:00
use Utils;
use Laracasts\Presenter\Presenter;
class ClientPresenter extends Presenter {
public function country()
{
return $this->entity->country ? $this->entity->country->name : '';
}
2016-02-04 19:36:39 +01:00
public function status()
{
$class = $text = '';
if ($this->entity->is_deleted) {
$class = 'danger';
$text = trans('texts.deleted');
} elseif ($this->entity->trashed()) {
$class = 'warning';
$text = trans('texts.archived');
} else {
$class = 'success';
$text = trans('texts.active');
}
return "<span class=\"label label-{$class}\">{$text}</span>";
2016-02-23 22:32:39 +01:00
}
2016-02-04 19:36:39 +01:00
2016-02-25 22:33:48 +01:00
public function url()
{
return URL::to('/clients/' . $this->entity->public_id);
}
2016-02-23 22:32:39 +01:00
public function link()
{
return link_to('/clients/' . $this->entity->public_id, $this->entity->getDisplayName());
2016-02-04 19:36:39 +01:00
}
2015-11-12 21:36:28 +01:00
}