Package-update-patch
Update Torann/GeoIP package from 0.2 to 1.0.0 which is being used to show country code in phone nuber in various forms.
This commit is contained in:
75
vendor/torann/geoip/src/GeoIPServiceProvider.php
vendored
Normal file
75
vendor/torann/geoip/src/GeoIPServiceProvider.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Torann\GeoIP;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class GeoIPServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerGeoIpService();
|
||||
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->registerResources();
|
||||
$this->registerGeoIpCommands();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register currency provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerGeoIpService()
|
||||
{
|
||||
$this->app->singleton('geoip', function ($app) {
|
||||
return new GeoIP(
|
||||
$app->config->get('geoip', []),
|
||||
$app['cache']
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register currency resources.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerResources()
|
||||
{
|
||||
if ($this->isLumen() === false) {
|
||||
$this->publishes([
|
||||
__DIR__ . '/../config/geoip.php' => config_path('geoip.php'),
|
||||
], 'config');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register currency commands.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerGeoIpCommands()
|
||||
{
|
||||
$this->commands([
|
||||
Console\Update::class,
|
||||
Console\Clear::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if package is running under Lumen app
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isLumen()
|
||||
{
|
||||
return str_contains($this->app->version(), 'Lumen') === true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user