Skip to content
Snippets Groups Projects
Commit 867bda38 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed time range when key has too few adfree searches

parent 84c3b6db
No related branches found
No related tags found
2 merge requests!1895Development,!1859added countdown to next change
......@@ -18,9 +18,10 @@ class KeyController extends Controller
{
$cookieLink = LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('loadSettings', Cookie::get()));
$key->canChange();
$changedAt = $key->keyinfo->KeyChangedAt;
if(!empty($changedAt)){
$changedAt = new Carbon($changedAt);
$changedAt = null;
if (!empty($key) && !empty($key->keyinfo) && !empty($key->keyinfo->KeyChangedAt)) {
$changedAt = $key->keyinfo->KeyChangedAt;
$changedAt = Carbon::createFromFormat('Y-m-d\TH:i:s.u\Z', $changedAt, "Europe/London");
}
return view('key')
->with('title', trans('titles.key'))
......
......@@ -46,7 +46,7 @@
<p>@lang('key.custom.p1')</p>
@if(app('App\Models\Key')->canChange())
<a class="btn btn-default" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('changeKeyOne')) }}">@lang('key.custom.a1')</a>
@elseif(!empty($changedAt))
@elseif(!empty($changedAt) && app('App\Models\Key')->keyinfo->adFreeSearches >= \App\Http\Controllers\KeyController::KEYCHANGE_ADFREE_SEARCHES)
<p>@lang('key.custom.p2', [
'nextchange' => trim(str_replace(" später", "", $changedAt->addSeconds(\App\Models\Key::CHANGE_EVERY)->longRelativeDiffForHumans(Carbon::now("Europe/London"), 2)))
])</p>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment