Fix FLEXIAPI-269 Update the IsNotPhoneNumber rule to use a better phone number validator

This commit is contained in:
Timothée Jaussoin 2025-02-13 11:58:44 +01:00
parent 2bf8db6bd1
commit b66cc28004
2 changed files with 3 additions and 1 deletions

View file

@ -18,6 +18,7 @@ v1.7
- Fix FLEXIAPI-264 Add -k|api_key_ip parameter to accounts:create-admin-account to set/clear the related API Key restriction - Fix FLEXIAPI-264 Add -k|api_key_ip parameter to accounts:create-admin-account to set/clear the related API Key restriction
- Fix FLEXIAPI-256 Publish an empty string while deleting a device on Redis to force the refresh on the other clients - Fix FLEXIAPI-256 Publish an empty string while deleting a device on Redis to force the refresh on the other clients
- Fix FLEXIAPI-268 Allow pn-param in Apple format for the push notifications endpoints - Fix FLEXIAPI-268 Allow pn-param in Apple format for the push notifications endpoints
- Fix FLEXIAPI-269 Update the IsNotPhoneNumber rule to use a better phone number validator
v1.6 v1.6
---- ----

View file

@ -4,12 +4,13 @@ namespace App\Rules;
use Illuminate\Contracts\Validation\Rule; use Illuminate\Contracts\Validation\Rule;
use Respect\Validation\Validator; use Respect\Validation\Validator;
use Propaganistas\LaravelPhone\PhoneNumber;
class IsNotPhoneNumber implements Rule class IsNotPhoneNumber implements Rule
{ {
public function passes($attribute, $value): bool public function passes($attribute, $value): bool
{ {
return (Validator::not(Validator::phone())->not(Validator::startsWith('+'))->validate($value)); return (new PhoneNumber($value))->getCountry() == null;
} }
public function message() public function message()