mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 07:02:34 +01:00
0fbda85a59
- Removed unused uses - Type hinting for method parameters - Removed commented code - Introduced comments for classes and methods - Short array syntax
32 lines
578 B
PHP
32 lines
578 B
PHP
<?php namespace App\Ninja\Presenters;
|
|
|
|
use URL;
|
|
use Laracasts\Presenter\Presenter;
|
|
|
|
class EntityPresenter extends Presenter
|
|
{
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function url()
|
|
{
|
|
$type = $this->entity->getEntityType();
|
|
$id = $this->entity->public_id;
|
|
$link = sprintf('/%ss/%s', $type, $id);
|
|
|
|
return URL::to($link);
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function link()
|
|
{
|
|
$name = $this->entity->getDisplayName();
|
|
$link = $this->url();
|
|
|
|
return link_to($link, $name)->toHtml();
|
|
}
|
|
}
|