File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -898,13 +898,12 @@ public function themeBackground(Request $request)
898898 //Delete custom background image
899899 public function removeBackground ()
900900 {
901+ $ userId = Auth::user ()->id ;
901902
902- $ user_id = Auth::user ()->id ;
903- $ path = findBackground ($ user_id );
904- $ path = base_path ('assets/img/background-img/ ' .$ path );
905-
906- if (File::exists ($ path )) {
907- File::delete ($ path );
903+ // Delete the user's current background image if it exists
904+ while (findBackground ($ userId ) !== "error.error " ) {
905+ $ avatarName = "assets/img/background-img/ " . findBackground (Auth::id ());
906+ unlink (base_path ($ avatarName ));
908907 }
909908
910909 return back ();
@@ -1055,11 +1054,12 @@ public function deleteUser(request $request)
10551054 //Delete profile picture
10561055 public function delProfilePicture ()
10571056 {
1058- $ user_id = Auth::user ()->id ;
1059- $ path = base_path (findAvatar ($ user_id ));
1057+ $ userId = Auth::user ()->id ;
10601058
1061- if (File::exists ($ path )) {
1062- File::delete ($ path );
1059+ // Delete the user's current avatar if it exists
1060+ while (findAvatar ($ userId ) !== "error.error " ) {
1061+ $ avatarName = findAvatar ($ userId );
1062+ unlink (base_path ($ avatarName ));
10631063 }
10641064
10651065 return back ();
You can’t perform that action at this time.
0 commit comments