mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add website()
to CompanyPresenter
This commit is contained in:
parent
fdd2023098
commit
8dd09be143
@ -12,6 +12,7 @@
|
||||
namespace App\Models\Presenters;
|
||||
|
||||
use App\Models\Country;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Class CompanyPresenter.
|
||||
@ -139,4 +140,24 @@ class CompanyPresenter extends EntityPresenter
|
||||
{
|
||||
return $this->entity->size ? $this->entity->size->name : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return company website URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function website(): string
|
||||
{
|
||||
$website = $this->entity->getSetting('website');
|
||||
|
||||
if (empty($website)) {
|
||||
return $website;
|
||||
}
|
||||
|
||||
if (Str::contains($website, ['http', 'https'])) {
|
||||
return $website;
|
||||
}
|
||||
|
||||
return \sprintf('http://%s', $website);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user