2022-06-06 14:27:17 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2023-01-28 23:21:40 +01:00
|
|
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
2022-06-06 14:27:17 +02:00
|
|
|
*
|
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Models\Presenters;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class VendorContactPresenter.
|
|
|
|
*/
|
|
|
|
class VendorContactPresenter extends EntityPresenter
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function name()
|
|
|
|
{
|
|
|
|
$contact_name = $this->entity->first_name.' '.$this->entity->last_name;
|
|
|
|
|
|
|
|
if (strlen($contact_name) > 1) {
|
|
|
|
return $contact_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->entity->vendor->present()->name();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function first_name()
|
|
|
|
{
|
|
|
|
return $this->entity->first_name ?: '';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function last_name()
|
|
|
|
{
|
|
|
|
return $this->entity->last_name ?: '';
|
|
|
|
}
|
|
|
|
}
|