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

32 lines
578 B
PHP
Raw Normal View History

2016-05-23 11:26:08 +02:00
<?php namespace App\Ninja\Presenters;
use URL;
use Laracasts\Presenter\Presenter;
class EntityPresenter extends Presenter
{
2016-05-23 11:26:08 +02:00
/**
* @return string
*/
2016-05-23 11:26:08 +02:00
public function url()
{
$type = $this->entity->getEntityType();
$id = $this->entity->public_id;
$link = sprintf('/%ss/%s', $type, $id);
return URL::to($link);
}
/**
* @return mixed
*/
2016-05-23 11:26:08 +02:00
public function link()
{
$name = $this->entity->getDisplayName();
$link = $this->url();
return link_to($link, $name)->toHtml();
}
}