Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -2,10 +2,10 @@
use Illuminate\Support\ServiceProvider;
use libphonenumber\PhoneNumberUtil;
use ReflectionClass;
class LaravelPhoneServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application events.
*
@@ -13,7 +13,9 @@ class LaravelPhoneServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->app['validator']->extend('phone', 'Propaganistas\LaravelPhone\PhoneValidator@validatePhone');
$extend = static::canUseDependentValidation() ? 'extendDependent' : 'extend';
$this->app['validator']->{$extend}('phone', 'Propaganistas\LaravelPhone\PhoneValidator@validatePhone');
}
/**
@@ -29,4 +31,16 @@ class LaravelPhoneServiceProvider extends ServiceProvider
$this->app->alias('libphonenumber', 'libphonenumber\PhoneNumberUtil');
}
/**
* Determine whether we can register a dependent validator.
*
* @return bool
*/
public static function canUseDependentValidation()
{
$validator = new ReflectionClass('\Illuminate\Validation\Factory');
return $validator->hasMethod('extendDependent');
}
}

View File

@@ -3,7 +3,7 @@
use Illuminate\Support\Facades\App;
use libphonenumber\PhoneNumberFormat;
if (! function_exists('phone_format')) {
if (! function_exists('phone')) {
/**
* Get the PhoneNumberUtil or format a phone number for display.
*