Skip to content

Commit 68f3c99

Browse files
committed
Refactor LoginController to improve years range calculation based on initial year and current year
1 parent 93d932d commit 68f3c99

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Http/Controllers/LoginController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ public function showLoginForm()
4848
if ($loginPath = config('nova.routes.login', false)) {
4949
return Inertia::location($loginPath);
5050
}
51-
$years = range(config('nova.initialyear'), date('Y'));
51+
52+
$initialYear = config('nova.initialyear', date('Y'));
53+
$currentYear = date('Y');
54+
$years = $initialYear <= $currentYear ? range($initialYear, $currentYear) : [];
5255
return Inertia::render('Nova.Login', [
5356
'years' => $years,
5457
]);

0 commit comments

Comments
 (0)