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:
Manish Verma
2016-11-03 15:28:03 +05:30
parent 580479f087
commit ca32203d6f
52 changed files with 2446 additions and 814 deletions

View 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;
}
}