From 3d2d83516dc70921de3e4fac5b0c9502819694a6 Mon Sep 17 00:00:00 2001 From: Admin Date: Tue, 18 Aug 2026 18:27:31 -0700 Subject: [PATCH] feat: implement admin login form request --- .../Requests/Admin/authLoginPostRequest.php | 41 +++++++++++++++++++ app/helpers/helpers.php | 19 +++++++++ 2 files changed, 60 insertions(+) create mode 100644 app/Http/Requests/Admin/authLoginPostRequest.php diff --git a/app/Http/Requests/Admin/authLoginPostRequest.php b/app/Http/Requests/Admin/authLoginPostRequest.php new file mode 100644 index 0000000..80c17fb --- /dev/null +++ b/app/Http/Requests/Admin/authLoginPostRequest.php @@ -0,0 +1,41 @@ +|string> + */ + public function rules(): array + { + return [ + 'username' => [ + 'required', + 'string', + 'alpha_num', + 'min:2', + 'max:32' + ], + 'password' => [ + 'required', + 'string', + 'min:8', + 'max:150' + ] + ]; + } +} diff --git a/app/helpers/helpers.php b/app/helpers/helpers.php index 627d5e8..225fde7 100644 --- a/app/helpers/helpers.php +++ b/app/helpers/helpers.php @@ -25,4 +25,23 @@ if (!function_exists('getFileUrl')) { return asset('storage/' . $file->path); } + + if (!function_exists('activeAdminSidebar')) { + + function activeAdminSidebar(string|array $routeNames): string + { + + $currentRouteName = \Illuminate\Support\Facades\Route::currentRouteName(); + + if (is_string($routeNames)) { + $routeNames = [$routeNames]; + } + + if (in_array($currentRouteName, $routeNames)) { + return 'active'; + } + + return ''; + } + } }