diff --git a/skolehjem/app/Http/Controllers/UserController.php b/skolehjem/app/Http/Controllers/UserController.php index f72cfd8..c99622b 100644 --- a/skolehjem/app/Http/Controllers/UserController.php +++ b/skolehjem/app/Http/Controllers/UserController.php @@ -340,6 +340,7 @@ class UserController extends Controller } else if($request->file("resource")) { // Else if you're editing the profile pic $user->update([ "resource_id" => ResourceController::store($request)->id ]); + return redirect()->route("users.account"); } else { // Else if you're not editing the password but anything else (Email, Phone Number). Then update user. $data = $request->only(['email', 'phone']); diff --git a/skolehjem/resources/views/app/users/editpic.blade.php b/skolehjem/resources/views/app/users/editpic.blade.php index 4e8d261..06270c5 100644 --- a/skolehjem/resources/views/app/users/editpic.blade.php +++ b/skolehjem/resources/views/app/users/editpic.blade.php @@ -11,8 +11,8 @@ @csrf @method("put") - @if(\App\Resource::query()->where("resource_id", "=",Auth::user()->resource_id)->first() != null) - + @if(\App\Resource::query()->where("id", "=", Auth::user()->resource_id)->first() !== null) + @else @if(request()->cookie("mode") == "dark")