From c476be7cff9c91657ed8fce49bf54f1b8488f8a1 Mon Sep 17 00:00:00 2001 From: fikyb Date: Tue, 21 May 2024 12:08:05 +0700 Subject: [PATCH] update fitur pass user --- app/Http/Controllers/UserController.php | 9 +++++++-- resources/views/user/index.blade.php | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index b4743fc..8c90e5e 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -40,7 +40,7 @@ public function store(Request $request){ $user->nama_gelar = $request->nama_gelar; $user->email = $request->email; $user->ettd = $request->ettd; - $user->password = Str::random(12); + $user->password = $request->password; if($user->save()){ return redirect()->route('users.index')->with('success','Data Telah Berhasil Disimpan'); @@ -74,8 +74,13 @@ public function update(Request $request){ $user->nama_gelar = $request->nama_gelar; $user->email = $request->email; $user->ettd = $request->ettd; - $user->password = Str::random(12); + if($request->password==""){ + $user->save(); + return redirect()->route('users.index')->with('success','Data Telah Berhasil Diubah'); + } + + $user->password = $request->password; if($user->save()){ return redirect()->route('users.index')->with('success','Data Telah Berhasil Diubah'); } diff --git a/resources/views/user/index.blade.php b/resources/views/user/index.blade.php index 9e7c997..6df2fc8 100644 --- a/resources/views/user/index.blade.php +++ b/resources/views/user/index.blade.php @@ -109,6 +109,8 @@ + + @@ -203,6 +205,8 @@ + +