@@ -20,7 +20,7 @@ class Profile extends Component
2020{
2121 use ProfileValidationRules, PasswordValidationRules;
2222
23- public $ user ;
23+ public ? User $ user ;
2424
2525 public string $ name = '' ;
2626
@@ -100,10 +100,10 @@ public function hasUnverifiedEmail(): bool
100100 public function updateProfileInformation (): void
101101 {
102102 $ this ->name = Str::trim ($ this ->name );
103-
103+
104104 $ this ->username = preg_replace ('/[\s+]/ ' , '_ ' , strtolower ($ this ->username ));
105105
106- $ validated = $ this ->validate ($ this ->profileRules ($ this ->user ->id ), $ this ->profileRulesErrorMessage ());
106+ $ validated = $ this ->validate ($ this ->profileRules ($ this ->user ->id ), $ this ->profileRulesErrorMessages ());
107107
108108 $ this ->user ->fill ($ validated );
109109
@@ -130,10 +130,10 @@ public function updateProfileInformation(): void
130130
131131 public function unlinkSocialAccount (string $ provider ): void
132132 {
133- $ socialAccontsById = Social::getUserBySocialAccoutsEmail ($ provider , $ this ->user ->email );
133+ $ socialAccontByEmail = Social::getUserBySocialAccountEmail ($ provider , $ this ->user ->email );
134134
135- if ($ socialAccontsById ->first ()) {
136- $ socialAccontsById ->delete ();
135+ if ($ socialAccontByEmail ->first ()) {
136+ $ socialAccontByEmail ->delete ();
137137
138138 if ($ provider == 'google ' ) {
139139 $ this ->socials_google = null ;
@@ -170,7 +170,7 @@ public function deleteAccount(): void
170170
171171 $ this ->user ->delete ();
172172
173- Session::flash ('status ' , 'User deleted successfully ' );
173+ Session::flash ('status ' , 'User deleted successfully! ' );
174174
175175 $ this ->redirectRoute ('users.home ' , navigate: true );
176176 }
0 commit comments