1
0
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:
David Bomba 2021-09-14 20:16:28 +10:00 committed by GitHub
commit 5b33546e46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -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