diff --git a/src/Http/Controllers/Auth/AuthenticatedSessionController.php b/src/Http/Controllers/Auth/AuthenticatedSessionController.php deleted file mode 100644 index 083b991..0000000 --- a/src/Http/Controllers/Auth/AuthenticatedSessionController.php +++ /dev/null @@ -1,82 +0,0 @@ -authenticatedSessionService = $authenticatedSessionService; - } - - /** - * Display the login view. - * - * @return View - */ - public function create(): View - { - return view('laraflow::auth.login'); - } - - /** - * Handle an incoming login request. - * - * @param LoginRequest $request - * @return RedirectResponse - */ - public function store(LoginRequest $request): RedirectResponse - { - $confirm = $this->authenticatedSessionService->attemptLogin($request); - - if ($confirm['status'] === true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->route($confirm['landing_page']); - } - - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back(); - } - - /** - * Destroy an authenticated session - * Handing logout request - * - * @param Request $request - * @return RedirectResponse - */ - public function destroy(Request $request): RedirectResponse - { - $confirm = $this->authenticatedSessionService->attemptLogout($request); - if ($confirm['status'] === true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->to(route('home')); - } - - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back(); - } -} diff --git a/src/Http/Controllers/Auth/ConfirmablePasswordController.php b/src/Http/Controllers/Auth/ConfirmablePasswordController.php deleted file mode 100644 index afb8fa7..0000000 --- a/src/Http/Controllers/Auth/ConfirmablePasswordController.php +++ /dev/null @@ -1,46 +0,0 @@ -validate([ - 'email' => $request->user()->email, - 'password' => $request->password, - ])) { - throw ValidationException::withMessages([ - 'password' => __('auth.password'), - ]); - } - - $request->session()->put('auth.password_confirmed_at', time()); - - return redirect()->back(); - } -} diff --git a/src/Http/Controllers/Auth/EmailVerificationNotificationController.php b/src/Http/Controllers/Auth/EmailVerificationNotificationController.php deleted file mode 100644 index b344e64..0000000 --- a/src/Http/Controllers/Auth/EmailVerificationNotificationController.php +++ /dev/null @@ -1,27 +0,0 @@ -user()->hasVerifiedEmail()) { - return redirect()->back(); - } - - $request->user()->sendEmailVerificationNotification(); - - return back()->with('status', 'verification-link-sent'); - } -} diff --git a/src/Http/Controllers/Auth/EmailVerificationPromptController.php b/src/Http/Controllers/Auth/EmailVerificationPromptController.php deleted file mode 100644 index becca51..0000000 --- a/src/Http/Controllers/Auth/EmailVerificationPromptController.php +++ /dev/null @@ -1,22 +0,0 @@ -user()->hasVerifiedEmail() - ? redirect()->back() - : view('laraflow::auth.verify-email'); - } -} diff --git a/src/Http/Controllers/Auth/NewPasswordController.php b/src/Http/Controllers/Auth/NewPasswordController.php deleted file mode 100644 index 1d300d1..0000000 --- a/src/Http/Controllers/Auth/NewPasswordController.php +++ /dev/null @@ -1,45 +0,0 @@ -newPasswordService = $newPasswordService; - } - - /** - * Display the password reset view. - * - * @param Request $request - * @return View - */ - public function create(Request $request): View - { - } - - /** - * Handle an incoming new password request. - * - * @param NewPasswordRequest $request - * @return void - */ - public function store(NewPasswordRequest $request) - { - } -} diff --git a/src/Http/Controllers/Auth/PasswordResetController.php b/src/Http/Controllers/Auth/PasswordResetController.php deleted file mode 100644 index cb897f8..0000000 --- a/src/Http/Controllers/Auth/PasswordResetController.php +++ /dev/null @@ -1,80 +0,0 @@ -passwordResetService = $passwordResetService; - } - - /** - * Display the password reset link request view. - * - */ - public function create() - { - return view('laraflow::auth.forgot-password'); - } - - /** - * Handle an incoming password reset link request. - * - * @param PasswordResetRequest $request - * @return RedirectResponse - */ - public function store(PasswordResetRequest $request): RedirectResponse - { - $inputs = $request->only('email', 'mobile', 'username'); - - $confirm = $this->passwordResetService->createPasswordResetToken($inputs); - - if ($confirm['status'] === true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->to(route('auth.password.reset', $confirm['token'])); - } - - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back(); - } - - public function edit($token) - { - return view('laraflow::auth.reset-password', ['token' => $token]); - } - - public function update(NewPasswordRequest $request) - { - $inputs = $request->only('email', 'mobile', 'username', 'password', 'password_confirmation', 'token'); - - $confirm = $this->passwordResetService->updatePassword($inputs); - - if ($confirm['status'] === true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->to(route('auth.login')); - } - - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back(); - } -} diff --git a/src/Http/Controllers/Auth/RegisteredUserController.php b/src/Http/Controllers/Auth/RegisteredUserController.php deleted file mode 100644 index 7888e8d..0000000 --- a/src/Http/Controllers/Auth/RegisteredUserController.php +++ /dev/null @@ -1,61 +0,0 @@ -registeredUserService = $registeredUserService; - } - - /** - * Display the registration view. - * - * @return Application|Factory|View - */ - public function create() - { - return view('laraflow::auth.register'); - } - - /** - * Handle an incoming registration request. - * - * @param RegisterRequest $request - * @return RedirectResponse - * @throws \Throwable - */ - public function store(RegisterRequest $request): RedirectResponse - { - $inputs = $request->all(); - $confirm = $this->registeredUserService->attemptRegistration($inputs); - - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->route(config('backend.config.home_url', 'admin.')); - } else { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back(); - } - } -} diff --git a/src/Http/Controllers/Auth/VerifyEmailController.php b/src/Http/Controllers/Auth/VerifyEmailController.php deleted file mode 100644 index b988d26..0000000 --- a/src/Http/Controllers/Auth/VerifyEmailController.php +++ /dev/null @@ -1,30 +0,0 @@ -user()->hasVerifiedEmail()) { - return redirect()->intended('/' . '?verified=1'); - } - - if ($request->user()->markEmailAsVerified()) { - event(new Verified($request->user())); - } - - return redirect()->intended('/' . '?verified=1'); - } -} diff --git a/src/Http/Controllers/Rbac/PermissionController.php b/src/Http/Controllers/Rbac/PermissionController.php deleted file mode 100644 index 8684b76..0000000 --- a/src/Http/Controllers/Rbac/PermissionController.php +++ /dev/null @@ -1,260 +0,0 @@ -authenticatedSessionService = $authenticatedSessionService; - $this->permissionService = $permissionService; - } - - /** - * Display a listing of the resource. - * - * @param Request $request - * @return Application|Factory|View - * @throws Exception - */ - public function index(Request $request) - { - $filters = $request->except('page'); - $permissions = $this->permissionService->permissionPaginate($filters); - - return view('backend.setting.permission.index', [ - 'permissions' => $permissions, - ]); - } - - /** - * Show the form for creating a new resource. - * - * @return Application|Factory|View - */ - public function create() - { - return view('backend.setting.permission.create'); - } - - /** - * Store a newly created resource in storage. - * - * @param PermissionRequest $request - * @return RedirectResponse - * @throws Exception|\Throwable - */ - public function store(PermissionRequest $request): RedirectResponse - { - $confirm = $this->permissionService->storePermission($request->except('_token')); - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->route('backend.settings.permissions.index'); - } - - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back()->withInput(); - } - - /** - * Display the specified resource. - * - * @param $id - * @return Application|Factory|View - * @throws Exception - */ - public function show($id) - { - if ($permission = $this->permissionService->getPermissionById($id)) { - return view('backend.setting.permission.show', [ - 'permission' => $permission, - 'timeline' => Utility::modelAudits($permission), - ]); - } - - abort(404); - } - - /** - * Show the form for editing the specified resource. - * - * @param $id - * @return Application|Factory|View - * @throws Exception - */ - public function edit($id) - { - if ($permission = $this->permissionService->getPermissionById($id)) { - return view('backend.setting.permission.edit', [ - 'permission' => $permission, - ]); - } - - abort(404); - } - - /** - * Update the specified resource in storage. - * - * @param PermissionRequest $request - * @param $id - * @return RedirectResponse - * @throws \Throwable - */ - public function update(PermissionRequest $request, $id): RedirectResponse - { - $confirm = $this->permissionService->updatePermission($request->except('_token', 'submit', '_method'), $id); - - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->route('backend.settings.permissions.index'); - } - - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back()->withInput(); - } - - /** - * Remove the specified resource from storage. - * - * @param $id - * @param Request $request - * @return RedirectResponse - * @throws \Throwable - */ - public function destroy($id, Request $request) - { - if ($this->authenticatedSessionService->validate($request)) { - $confirm = $this->permissionService->destroyPermission($id); - - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } else { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } - - return redirect()->route('backend.settings.permissions.index'); - } - abort(403, 'Wrong user credentials'); - } - - /** - * Restore a Soft Deleted Resource - * - * @param $id - * @param Request $request - * @return RedirectResponse|void - * @throws \Throwable - */ - public function restore($id, Request $request) - { - if ($this->authenticatedSessionService->validate($request)) { - $confirm = $this->permissionService->restorePermission($id); - - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } else { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } - - return redirect()->route('backend.settings.permissions.index'); - } - abort(403, 'Wrong user credentials'); - } - - /** - * Display a listing of the resource. - * - * @return string|StreamedResponse - * @throws Exception - */ - public function export(Request $request) - { - $filters = $request->except('page'); - - $permissionExport = $this->permissionService->exportPermission($filters); - - $filename = 'Permission-' . date('Ymd-His') . '.' . ($filters['format'] ?? 'xlsx'); - - return $permissionExport->download($filename, function ($permission) use ($permissionExport) { - return $permissionExport->map($permission); - }); - } - - /** - * Return an Import view page - * - * @return Application|Factory|View - */ - public function import() - { - return view('backend.setting.permission.import'); - } - - /** - * Display a listing of the resource. - * - * @return Application|Factory|View - * @throws Exception - */ - public function importBulk(Request $request) - { - $filters = $request->except('page'); - $permissions = $this->permissionService->getAllPermissions($filters); - - return view('backend.setting.permission.index', [ - 'permissions' => $permissions, - ]); - } - - /** - * Display a detail of the resource. - * - * @return StreamedResponse|string - * @throws Exception - */ - public function print(Request $request) - { - $filters = $request->except('page'); - - $permissionExport = $this->permissionService->exportPermission($filters); - - $filename = 'Permission-' . date('Ymd-His') . '.' . ($filters['format'] ?? 'xlsx'); - - return $permissionExport->download($filename, function ($permission) use ($permissionExport) { - return $permissionExport->map($permission); - }); - } -} diff --git a/src/Http/Controllers/Rbac/RoleController.php b/src/Http/Controllers/Rbac/RoleController.php deleted file mode 100644 index df42853..0000000 --- a/src/Http/Controllers/Rbac/RoleController.php +++ /dev/null @@ -1,353 +0,0 @@ -roleService = $roleService; - $this->authenticatedSessionService = $authenticatedSessionService; - $this->permissionService = $permissionService; - } - - /** - * Display a listing of the resource. - * - * @param Request $request - * @return Application|Factory|View - * @throws Exception - */ - public function index(Request $request) - { - $filters = $request->except('_token'); - $roles = $this->roleService->rolePaginate($filters); - - return view('backend.setting.role.index', [ - 'roles' => $roles, - ]); - } - - /** - * Show the form for creating a new resource. - * - * @return Application|Factory|View - */ - public function create() - { - return view('backend.setting.role.create'); - } - - /** - * Store a newly created resource in storage. - * - * @param RoleRequest $request - * @return RedirectResponse - * @throws Exception|Throwable - */ - public function store(RoleRequest $request): RedirectResponse - { - $confirm = $this->roleService->storeRole($request->except('_token')); - - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->route('backend.settings.roles.index'); - } - - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back()->withInput(); - } - - /** - * Display the specified resource. - * - * @param int $id - * @return Application|Factory|View - * @throws Exception - */ - public function show(int $id) - { - if ($role = $this->roleService->getRoleById($id)) { - $permissions = $this->permissionService->getAllPermissions([ - 'sort' => 'display_name', 'direction' => 'asc', - ]); - - $availablePermissionIds = $role->permissions()->pluck('id')->toArray(); - - return view('backend.setting.role.show', [ - 'role' => $role, - 'permissions' => $permissions, - 'availablePermissionIds' => $availablePermissionIds, - 'timeline' => Utility::modelAudits($role), - ]); - } - - abort(404); - } - - /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return Application|Factory|View - * @throws Exception - */ - public function edit($id) - { - if ($role = $this->roleService->getRoleById($id)) { - return view('backend.setting.role.edit', ['role' => $role]); - } - - abort(404); - } - - /** - * Update the specified resource in storage. - * - * @param RoleRequest $request - * @param $id - * @return RedirectResponse - * @throws Throwable - */ - public function update(RoleRequest $request, $id): RedirectResponse - { - $confirm = $this->roleService->updateRole($request->except('_token', 'submit', '_method'), $id); - - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->route('backend.settings.roles.index'); - } - - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back()->withInput(); - } - - /** - * Remove the specified resource from storage. - * - * @param int $id - * @param Request $request - * @return RedirectResponse - * @throws Throwable - */ - public function destroy($id, Request $request) - { - if ($this->authenticatedSessionService->validate($request)) { - $confirm = $this->roleService->destroyRole($id); - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } else { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } - - return redirect()->route('backend.settings.roles.index'); - } - abort(403, 'Wrong user credentials'); - } - - /** - * Restore a Soft Deleted Resource - * - * @param $id - * @param Request $request - * @return RedirectResponse|void - * @throws \Throwable - */ - public function restore($id, Request $request) - { - if ($this->authenticatedSessionService->validate($request)) { - $confirm = $this->roleService->restoreRole($id); - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } else { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } - - return redirect()->route('backend.settings.roles.index'); - } - abort(403, 'Wrong user credentials'); - } - - /** - * Return an Import view page - * - * @return Application|Factory|View - */ - public function import() - { - return view('backend.setting.permission.import'); - } - - /** - * Display a listing of the resource. - * - * @return Application|Factory|View - * @throws Exception - */ - public function importBulk(Request $request) - { - $filters = $request->except('page'); - $permissions = $this->permissionService->getAllPermissions($filters); - - return view('backend.setting.permission.index', [ - 'permissions' => $permissions, - ]); - } - - /** - * Display a listing of the resource. - * - * @return string|StreamedResponse - * @throws Exception - */ - public function export(Request $request) - { - $filters = $request->except('page'); - - $roleExport = $this->roleService->exportRole($filters); - - $filename = 'Role-' . date('Ymd-His') . '.' . ($filters['format'] ?? 'xlsx'); - - return $roleExport->download($filename, function ($role) use ($roleExport) { - return $roleExport->map($role); - }); - } - - /** - * Display a detail of the resource. - * - * @return StreamedResponse|string - * @throws Exception - */ - public function print(Request $request) - { - $filters = $request->except('page'); - - $roleExport = $this->roleService->exportRole($filters); - - $filename = 'Role-' . date('Ymd-His') . '.' . ($filters['format'] ?? 'xlsx'); - - return $roleExport->download($filename, function ($role) { - $format = [ - '#' => $role->id, - 'Display Name' => $role->display_name, - 'System Name' => $role->name, - 'Guard' => ucfirst($role->guard_name), - 'Remarks' => $role->remarks, - 'Enabled' => ucfirst($role->enabled), - 'Created' => $role->created_at->format(config('backend.datetime')), - 'Updated' => $role->updated_at->format(config('backend.datetime')), - ]; - if (AuthenticatedSessionService::isSuperAdmin()): - $format['Deleted'] = ($role->deleted_at != null) - ? $role->deleted_at->format(config('backend.datetime')) - : null; - - $format['Creator'] = ($role->createdBy != null) - ? $role->createdBy->name - : null; - - $format['Editor'] = ($role->updatedBy != null) - ? $role->updatedBy->name - : null; - $format['Destructor'] = ($role->deletedBy != null) - ? $role->deletedBy->name - : null; - endif; - - return $format; - }); - } - - /** - * @param $id - * @param Request $request - * @return JsonResponse|void - * @throws Exception - */ - public function permission($id, Request $request) - { - if ($request->ajax()) { - $jsonResponse = ['message' => null, 'errors' => []]; - - if ($role = $this->roleService->getRoleById($id)) { - $roles = $request->get('permissions', []); - $confirm = $this->roleService->syncPermission($id, $roles); - - //formatted response is collected from service - return response()->json(array_merge($jsonResponse, $confirm)); - } else { - throw ValidationException::withMessages([ - 'role' => 'Invalid Role Id Provided', - ]); - } - } - - abort(403); - } - - /** - * Display a listing of the resource. - * - * @param Request $request - * @return JsonResponse - * @throws Exception - */ - public function ajax(Request $request): JsonResponse - { - $filters = $request->except('_token'); - - if ($filters['paginate'] === true): - $roles = $this->roleService->rolePaginate($filters, ['permissions']); else : - $roles = $this->roleService->getAllRoles($filters, ['permissions']); - endif; - - return response()->json($roles, 200); - } -} diff --git a/src/Http/Controllers/Rbac/UserController.php b/src/Http/Controllers/Rbac/UserController.php deleted file mode 100644 index 69fbaf2..0000000 --- a/src/Http/Controllers/Rbac/UserController.php +++ /dev/null @@ -1,298 +0,0 @@ -userService = $userService; - $this->authenticatedSessionService = $authenticatedSessionService; - $this->roleService = $roleService; - } - - /** - * Display a listing of the resource. - * - * @return Application|Factory|View - * @throws \Exception - */ - public function index(Request $request): View - { - $filters = $request->except('page'); - $filters['role'] = [2, 3, 4]; - - if (AuthenticatedSessionService::isSuperAdmin()) { - $filters['role'][] = 1; - } - - $users = $this->userService->userPaginate($filters); - - return view('backend.setting.user.index', [ - 'users' => $users, - ]); - } - - /** - * Show the form for creating a new resource. - * - * @return Application|Factory|View - * @throws Exception - */ - public function create(): View - { - $roles = $this->roleService->roleDropdown(); - - return view('backend.setting.user.create', [ - 'roles' => $roles, - ]); - } - - /** - * Store a newly created resource in storage. - * - * @param UserRequest $request - * @return RedirectResponse - * @throws \Throwable - */ - public function store(UserRequest $request): RedirectResponse - { - $inputs = $request->except(['_token', 'password_confirmation']); - - $photo = $request->file('photo'); - - $confirm = $this->userService->storeUser($inputs, $photo); - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->route('backend.settings.users.index'); - } - - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back()->withInput(); - } - - /** - * Display the specified resource. - * - * @param int $id - * @return Application|Factory|View|void - * @throws \Exception - */ - public function show(int $id) - { - if ($user = $this->userService->getUserById($id)) { - return view('backend.setting.user.show', [ - 'user' => $user, - 'timeline' => Utility::modelAudits($user), - ]); - } - - abort(404); - } - - /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return Application|Factory|View - * @throws \Exception - */ - public function edit(int $id) - { - if ($user = $this->userService->getUserById($id)) { - $roles = $this->roleService->roleDropdown(); - $user_roles = $user->roles()->pluck('id')->toArray() ?? []; - - return view('backend.setting.user.edit', [ - 'user' => $user, - 'roles' => $roles, - 'user_roles' => $user_roles, - ]); - } - - abort(404); - } - - /** - * Update the specified resource in storage. - * - * @param UserRequest $request - * @param $id - * @return RedirectResponse - * @throws \Throwable - */ - public function update(UserRequest $request, $id): RedirectResponse - { - $inputs = $request->except(['_token', 'password_confirmation']); - - $photo = $request->file('photo'); - - $confirm = $this->userService->updateUser($inputs, $id, $photo); - - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->route('backend.settings.users.index'); - } - - notify($confirm['message'], $confirm['level'], $confirm['title']); - - return redirect()->back()->withInput(); - } - - /** - * Remove the specified resource from storage. - * @param $id - * @param Request $request - * @return RedirectResponse|void - * @throws \Throwable - */ - public function destroy($id, Request $request) - { - if ($this->authenticatedSessionService->validate($request)) { - $confirm = $this->userService->destroyUser($id); - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } else { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } - - return redirect()->route('backend.settings.users.index'); - } - - abort(403, 'Wrong user credentials'); - } - - /** - * Restore a Soft Deleted Resource - * - * @param $id - * @param Request $request - * @return RedirectResponse|void - * @throws \Throwable - */ - public function restore($id, Request $request) - { - if ($this->authenticatedSessionService->validate($request)) { - $confirm = $this->userService->restoreUser($id); - if ($confirm['status'] == true) { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } else { - notify($confirm['message'], $confirm['level'], $confirm['title']); - } - - return redirect()->route('backend.settings.users.index'); - } - - abort(403, 'Wrong user credentials'); - } - - /** - * Return an Import view page - * - * @return Application|Factory|View - */ - public function import() - { - return view('backend.settings.user.permission.import'); - } - - /** - * Display a listing of the resource. - * - * @return Application|Factory|View - * @throws Exception - */ - public function importBulk(Request $request) - { - $filters = $request->except('page'); - $users = $this->userService->getAllUsers($filters); - - return view('backend.setting.user.index', [ - 'users' => $users, - ]); - } - - /** - * Display a listing of the resource. - * - * @return string|StreamedResponse - * @throws Exception - */ - public function export(Request $request) - { - $filters = $request->except('page'); - - $userExport = $this->userService->exportUser($filters); - - $filename = 'User-' . date('Ymd-His') . '.' . ($filters['format'] ?? 'xlsx'); - - return $userExport->download($filename, function ($user) use ($userExport) { - return $userExport->map($user); - }); - } - - /** - * Display a detail of the resource. - * - * @return StreamedResponse|string - * @throws Exception - */ - public function print(Request $request) - { - $filters = $request->except('page'); - - $userExport = $this->userService->exportUser($filters); - - $filename = 'User-' . date('Ymd-His') . '.' . ($filters['format'] ?? 'xlsx'); - - return $userExport->download($filename, function ($user) use ($userExport) { - return $userExport->map($user); - }); - } -} diff --git a/src/Http/Requests/Auth/LoginRequest.php b/src/Http/Requests/Auth/LoginRequest.php deleted file mode 100644 index 184870c..0000000 --- a/src/Http/Requests/Auth/LoginRequest.php +++ /dev/null @@ -1,51 +0,0 @@ - 'required|string|min:3|max:255', - 'agree_terms' => 'required|string', - ]; - - //Credential Field - if (config('triplea.credential_field') == Constant::LOGIN_EMAIL - || (config('triplea.credential_field') == Constant::LOGIN_OTP - && config('triplea.credential_otp_field') == Constant::OTP_EMAIL)) { - $rules['email'] = 'required|min:10|max:255|string|email:rfc,dns'; - } elseif (config('triplea.credential_field') == Constant::LOGIN_MOBILE - || (config('triplea.credential_field') == Constant::LOGIN_OTP - && config('triplea.credential_otp_field') == Constant::OTP_MOBILE)) { - $rules['mobile'] = ['required', 'string', 'min:11', 'max:11', new PhoneNumber()]; - } elseif (config('triplea.credential_field') == Constant::LOGIN_USERNAME) { - $rules['username'] = ['required', new Username(), 'min:5', 'max:255', 'string']; - } - - //Password Field - if (config('triplea.credential_field') != Constant::LOGIN_OTP) { - $rules['password'] = ['required', 'confirmed', 'min:' . config('triplea.minimum_password_length'), 'max:255', 'string']; - } - - return $rules; - } -} diff --git a/src/Http/Requests/Rbac/PermissionRequest.php b/src/Http/Requests/Rbac/PermissionRequest.php deleted file mode 100644 index 5a21d2d..0000000 --- a/src/Http/Requests/Rbac/PermissionRequest.php +++ /dev/null @@ -1,38 +0,0 @@ - "required|string", - "guard_name" => "required|string", - "display_name" => "required|string", - "enabled" => "required|string", - "remarks" => "nullable|string", - ]; - } - - /** - * Determine if the user is authorized to make this request. - * - * @return bool - */ - public function authorize() - { - return true; - } -} diff --git a/src/Http/Requests/Rbac/RoleRequest.php b/src/Http/Requests/Rbac/RoleRequest.php deleted file mode 100644 index dd584f2..0000000 --- a/src/Http/Requests/Rbac/RoleRequest.php +++ /dev/null @@ -1,37 +0,0 @@ - "required|string", - "guard_name" => "required|string", - "enabled" => "required|string", - "remarks" => "nullable|string", - ]; - } - - /** - * Determine if the user is authorized to make this request. - * - * @return bool - */ - public function authorize() - { - return true; - } -} diff --git a/src/Http/Requests/Rbac/UserRequest.php b/src/Http/Requests/Rbac/UserRequest.php deleted file mode 100644 index 9bbaf34..0000000 --- a/src/Http/Requests/Rbac/UserRequest.php +++ /dev/null @@ -1,64 +0,0 @@ - ['required', 'string', 'min:3', 'max:255'], - 'photo' => ['nullable', 'image', 'max:10000'], - 'enabled' => ['nullable', 'string', 'min:2', 'max:3'], - 'role_id' => ['required', 'array', 'min:1', 'max:3'], - 'role_id.*' => ['required', 'integer', 'min:1', 'max:255'], - 'remarks' => ['nullable', 'string', 'min:3', 'max:255'], - 'username' => ['string', 'min:5', 'max:255', new Username(), 'unique:users,username,' . $this->user], - 'email' => ['string', 'min:3', 'max:255', 'email', 'unique:users,email,' . $this->user], - 'mobile' => ['string', 'min:11', 'max:13', new PhoneNumber(), 'unique:users,mobile,' . $this->user], - ]; - - - //Credential Field - if (config('auth.credential_field') == Constant::LOGIN_EMAIL - || (config('auth.credential_field') == Constant::LOGIN_OTP - && config('auth.credential_otp_field') == Constant::OTP_EMAIL)): - array_push($rules['email'], 'required'); else : - array_push($rules['email'], 'nullable'); - endif; - - if (config('auth.credential_field') == Constant::LOGIN_MOBILE - || (config('auth.credential_field') == Constant::LOGIN_OTP - && config('auth.credential_otp_field') == Constant::OTP_MOBILE)) : - array_push($rules['mobile'], 'required'); else : - array_push($rules['mobile'], 'nullable'); - endif; - - if (config('auth.credential_field') == Constant::LOGIN_USERNAME) : - array_push($rules['username'], 'required'); else : - array_push($rules['username'], 'nullable'); - endif; - - return $rules; - } -}