flexisip-account-manager/flexiapi/app/Rules/IsNotPhoneNumber.php
Timothée Jaussoin 88e2e049c4 Fix cases where alias and username can both be phone numbers but different
Update the views and add a test for FlexiAPI
Update the dependencies
2022-03-07 14:21:41 +01:00

19 lines
439 B
PHP

<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Respect\Validation\Validator;
class IsNotPhoneNumber implements Rule
{
public function passes($attribute, $value): bool
{
return (Validator::not(Validator::phone())->not(Validator::startsWith('+'))->noWhitespace()->validate($value));
}
public function message()
{
return 'The :attribute should not be a phone number';
}
}