update v1.0.6
This commit is contained in:
@@ -3,9 +3,20 @@
|
||||
use Illuminate\Support\Facades\App;
|
||||
use libphonenumber\PhoneNumberFormat;
|
||||
|
||||
function phone_format($phone, $country, $format = null) {
|
||||
$lib = App::make('libphonenumber');
|
||||
$phoneNumber = $lib->parse($phone, $country);
|
||||
$format = is_null($format) ? PhoneNumberFormat::INTERNATIONAL : $format;
|
||||
return $lib->format($phoneNumber, $format);
|
||||
if (!function_exists('phone_format')) {
|
||||
/**
|
||||
* Formats a phone number and country for display.
|
||||
*
|
||||
* @param string $phone
|
||||
* @param string $country
|
||||
* @param int|null $format
|
||||
* @return string
|
||||
*/
|
||||
function phone_format($phone, $country, $format = PhoneNumberFormat::INTERNATIONAL)
|
||||
{
|
||||
$lib = App::make('libphonenumber');
|
||||
$phoneNumber = $lib->parse($phone, $country);
|
||||
|
||||
return $lib->format($phoneNumber, $format);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user