@@ -131,22 +131,19 @@ public function scopeHasNumber(Builder $query, string $search): Builder
131131
132132 public function scopeHasPhoneNumberWithOwner ($ query , string $ country_code , string $ number , string $ user_type ): void
133133 {
134- $ query ->where ('country_code ' , $ country_code )
135- ->where ('number ' , $ number )
136- ->where ('user_type ' , $ user_type )
134+ $ query ->hasPhoneNumber ($ country_code , $ number , $ user_type )
137135 ->where ('user_id ' , '!= ' , null );
138136 }
139137
140138 public function scopeHasPhoneNumberWithoutOwner ($ query , string $ country_code , string $ number , string $ user_type ): void
141139 {
142- $ query ->where ('country_code ' , $ country_code )
143- ->where ('number ' , $ number )
144- ->where ('user_type ' , $ user_type )
140+ $ query ->hasPhoneNumber ($ country_code , $ number , $ user_type )
145141 ->whereNull ('user_id ' );
146142 }
147143
148144 public function scopeHasPhoneNumber ($ query , string $ country_code , string $ number , string $ user_type ): void
149145 {
146+ $ number = MobileVerification::normalizeNumber ($ number );
150147 $ query ->where ('country_code ' , $ country_code )
151148 ->where ('number ' , $ number )
152149 ->where ('user_type ' , $ user_type );
0 commit comments