mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Merge pull request #6641 from beganovich/v5-684
Fixes for company website on login page
This commit is contained in:
commit
5b33546e46
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -77,10 +77,10 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(!is_null($company) && !empty($company->getSetting('website')))
|
||||
@if(!empty($company->present()->website()))
|
||||
<div class="mt-5 text-center">
|
||||
<a class="button-link text-sm" href="{{ $company->getSetting('website') }}">
|
||||
{{ ctrans('texts.back_to', ['url' => parse_url($company->getSetting('website'))['host'] ?? $company->getSetting('website') ]) }}
|
||||
<a class="button-link text-sm" href="{{ $company->present()->website() }}">
|
||||
{{ ctrans('texts.back_to', ['url' => parse_url($company->present()->website())['host'] ?? $company->present()->website() ]) }}
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
|
Loading…
Reference in New Issue
Block a user