diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 0562e8c..b9bd4a8 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use Illuminate\Auth\Events\Registered; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; use App\Http\Requests\UserRequest; @@ -23,13 +24,17 @@ class UserController extends Controller if (! $o->exists) $o->password = base64_encode(random_bytes(20)); + elseif ($request->password) + $o->password = Hash::make($request->password); $o->save(); if ($o->wasRecentlyCreated) event(new Registered($o)); - return redirect()->to('user'); + return redirect() + ->to('user/addedit/'.$o->id) + ->with('success','User Updated'); } return view('user.addedit') diff --git a/resources/views/user/addedit.blade.php b/resources/views/user/addedit.blade.php index 057bb65..0b95f0a 100644 --- a/resources/views/user/addedit.blade.php +++ b/resources/views/user/addedit.blade.php @@ -11,6 +11,8 @@