diff --git a/app/Http/Controllers/KeyController.php b/app/Http/Controllers/KeyController.php index e1e3876..fab3f51 100644 --- a/app/Http/Controllers/KeyController.php +++ b/app/Http/Controllers/KeyController.php @@ -19,6 +19,13 @@ class KeyController extends Controller if (!$fetchKeys->isEmpty()) { if ($activeKey->created_at->addWeek()->gt(Carbon::now())) { $canCreate = false; + if (User::isAdmin()) { + if ($activeKey->created_at->addMinute()->gt(Carbon::now())) { + $canCreate = false; + } else { + $canCreate = true; + } + } } else { $canCreate = true; } @@ -41,7 +48,7 @@ class KeyController extends Controller // Validation if (!$fetchKeys->isEmpty() && $activeKey->created_at->addWeek()->gt(Carbon::now())) { - if (!User::isAdmin()) + if (!User::isAdmin() || $activeKey->created_at->addMinute()->gt(Carbon::now())) abort(404); } @@ -53,4 +60,4 @@ class KeyController extends Controller return redirect()->route('key_index'); } -} +} \ No newline at end of file diff --git a/resources/views/invite/index.blade.php b/resources/views/invite/index.blade.php index aaac8dc..a0bc897 100644 --- a/resources/views/invite/index.blade.php +++ b/resources/views/invite/index.blade.php @@ -6,17 +6,16 @@ @section('content')
You may create @if ($data['fetchKeys']->isEmpty()) your first key below! @else - @if (App\Models\User::isAdmin()) as many keys as you wish because you're an admin. @else a new key because it's been 1 week since creating your last key. @endif @endif + @if (App\Models\User::isAdmin()) a new key every minute because you're an admin. @else a new key because it's been 1 week since creating your last key. @endif @endif
@else -You cannot create a new key because 1 week hasn't passed since creating your last key. You can find your - key(s) below.
+@if (App\Models\User::isAdmin()) You cannot create a new key because 1 minute hasn't passed since creating your last key. You can find your key(s) below.. @else You cannot create a new key because 1 week hasn't passed since creating your last key. You can find your key(s) below. @endif
@endif