laravel-6 support

This commit is contained in:
RafficMohammed
2023-01-08 01:17:22 +05:30
parent 1a5c16ae4b
commit 774eed8b0e
4962 changed files with 279380 additions and 297961 deletions

View File

@@ -1,5 +1,5 @@
The BSD 2-Clause License
Copyright (c) 2013-2018, Daniel Stainback
Copyright (c) 2013-2020, Daniel Stainback
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

View File

@@ -18,9 +18,10 @@ Determine the geographical location and currency of website visitors based on th
Documentation for the package can be found on [Lyften.com](http://lyften.com/projects/laravel-geoip/).
## Laravel 4
## Older versions of Laravel
For Laravel 4 Installation see [version 0.1.1](https://github.com/Torann/laravel-geoip/tree/0.1.1)
- Laravel 5 [version 1.1](https://github.com/Torann/laravel-geoip/tree/1.1)
- Laravel 4 [version 0.1.1](https://github.com/Torann/laravel-geoip/tree/0.1.1)
## Contributions

View File

@@ -3,7 +3,6 @@
"description": "Support for multiple GeoIP services.",
"keywords": [
"laravel",
"laravel 5",
"geoip",
"location",
"geolocation",
@@ -19,19 +18,19 @@
}
],
"require": {
"php": "^7.1",
"illuminate/support": "~5.5|^6.0",
"illuminate/console": "~5.5|^6.0"
"php": "^7.2",
"illuminate/support": "^6.0|^7.0",
"illuminate/console": "^6.0|^7.0"
},
"suggest": {
"geoip2/geoip2": "Required to use the MaxMind database or web service with GeoIP (~2.1).",
"monolog/monolog": "Allows for storing location not found errors to the log"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^8.0",
"mockery/mockery": "^1.3",
"geoip2/geoip2": "~2.1",
"vlucas/phpdotenv": "^3.5"
"vlucas/phpdotenv": "^4.0"
},
"autoload": {
"files": [

View File

@@ -6,6 +6,26 @@ use ArrayAccess;
use Illuminate\Support\Str;
use Illuminate\Support\Arr;
/**
* Class Location
*
* @property string|null $ip
* @property string|null $iso_code
* @property string|null $country
* @property string|null $city
* @property string|null $state
* @property string|null $state_name
* @property string|null $postal_code
* @property float|null $lat
* @property float|null $lon
* @property string|null $timezone
* @property string|null $continent
* @property string|null $currency
* @property bool $default
* @property bool $cached
*
* @package Torann\GeoIP
*/
class Location implements ArrayAccess
{
/**
@@ -199,4 +219,4 @@ class Location implements ArrayAccess
{
unset($this->attributes[$key]);
}
}
}

View File

@@ -22,14 +22,17 @@ class MaxMindDatabase extends AbstractService
*/
public function boot()
{
$path = $this->config('database_path');
// Copy test database for now
if (file_exists($this->config('database_path')) === false) {
copy(__DIR__ . '/../../resources/geoip.mmdb', $this->config('database_path'));
if (is_file($path) === false) {
@mkdir(dirname($path));
copy(__DIR__ . '/../../resources/geoip.mmdb', $path);
}
$this->reader = new Reader(
$this->config('database_path'),
$this->config('locales', ['en'])
$path, $this->config('locales', ['en'])
);
}
@@ -90,7 +93,8 @@ class MaxMindDatabase extends AbstractService
* Provide a temporary directory to perform operations in and and ensure
* it is removed afterwards.
*
* @param callable $callback
* @param callable $callback
*
* @return void
*/
protected function withTemporaryDirectory(callable $callback)
@@ -113,7 +117,8 @@ class MaxMindDatabase extends AbstractService
/**
* Recursively search the given archive to find the .mmdb file.
*
* @param \PharData $archive
* @param \PharData $archive
*
* @return mixed
* @throws \Exception
*/
@@ -135,16 +140,17 @@ class MaxMindDatabase extends AbstractService
/**
* Recursively delete the given directory.
*
* @param string $directory
* @param string $directory
*
* @return mixed
*/
protected function deleteDirectory(string $directory)
{
if (!file_exists($directory)) {
if (! file_exists($directory)) {
return true;
}
if (!is_dir($directory)) {
if (! is_dir($directory)) {
return unlink($directory);
}
@@ -153,7 +159,7 @@ class MaxMindDatabase extends AbstractService
continue;
}
if (!$this->deleteDirectory($directory . DIRECTORY_SEPARATOR . $item)) {
if (! $this->deleteDirectory($directory . DIRECTORY_SEPARATOR . $item)) {
return false;
}
}