Skip to content

Commit eba3ab7

Browse files
committed
Refactor Login component to remove years method and update initial year configuration; adjust LoginController to pass years to the view.
1 parent 3361c8d commit eba3ab7

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

config/nova.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,13 @@
203203
'stopped' => '/',
204204
],
205205

206+
/*
207+
|--------------------------------------------------------------------------
208+
| Initial Years in Year Option On login form
209+
|--------------------------------------------------------------------------
210+
|
211+
*/
212+
213+
'initialyear' => env('NOVA_INITIAL_YEAR', 2024),
214+
206215
];

public/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/app.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=38072b67506bc1bf7d841e00a4645298",
2+
"/app.js": "/app.js?id=681cce33922a4fe46f7fe15735cef6cb",
33
"/manifest.js": "/manifest.js?id=61f2d62cc41feccba141cbb9c3075397",
44
"/app.css": "/app.css?id=a0015dae19ee9535245eef6cf827b723",
55
"/vendor.js": "/vendor.js?id=4b9f97134193d3a20991ba9c2f5f06e3",

resources/js/pages/Login.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ export default {
146146
forgotPasswordPath() {
147147
return Nova.config('forgotPasswordPath')
148148
},
149-
years () {
150-
const year = new Date().getFullYear()
151-
return Array.from({length: year - 2023}, (value, index) => year - index)
152-
},
153149
},
154150
}
155151
</script>

src/Http/Controllers/LoginController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public function showLoginForm()
4848
if ($loginPath = config('nova.routes.login', false)) {
4949
return Inertia::location($loginPath);
5050
}
51-
52-
return Inertia::render('Nova.Login', []);
51+
$years = range(config('nova.initialyear'), date('Y'));
52+
return Inertia::render('Nova.Login', ['years' => $years]);
5353
}
5454

5555
/**

0 commit comments

Comments
 (0)