mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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;
|
namespace App\Models\Presenters;
|
||||||
|
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CompanyPresenter.
|
* Class CompanyPresenter.
|
||||||
@ -139,4 +140,24 @@ class CompanyPresenter extends EntityPresenter
|
|||||||
{
|
{
|
||||||
return $this->entity->size ? $this->entity->size->name : '';
|
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>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if(!is_null($company) && !empty($company->getSetting('website')))
|
@if(!empty($company->present()->website()))
|
||||||
<div class="mt-5 text-center">
|
<div class="mt-5 text-center">
|
||||||
<a class="button-link text-sm" href="{{ $company->getSetting('website') }}">
|
<a class="button-link text-sm" href="{{ $company->present()->website() }}">
|
||||||
{{ ctrans('texts.back_to', ['url' => parse_url($company->getSetting('website'))['host'] ?? $company->getSetting('website') ]) }}
|
{{ ctrans('texts.back_to', ['url' => parse_url($company->present()->website())['host'] ?? $company->present()->website() ]) }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user