Skip to content

Commit

Permalink
Update get function to have default precision
Browse files Browse the repository at this point in the history
  • Loading branch information
midnite81 committed Jan 18, 2018
1 parent 563a0aa commit f0e5361
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Before using this package you must get an API Key from IP Info DB. Please access
public function index(GeoLocation $geo, Request $request)
{
$ipLocation = $geo->getCity($request->ip());
// if you do $geo->get($request->ip()), the default precision is now city

// $ipLocation is an IpLocation Object
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Services/GeoLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface GeoLocation
* @param $precision
* @return Midnite81\GeoLocation\Services\IpLocation
*/
public function get($ip, $precision);
public function get($ip, $precision = 'city');

/**
* Get IP information with City Precision
Expand Down
2 changes: 1 addition & 1 deletion src/Services/GeoLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GeoLocation implements GeoLocationContract
* @return IpLocation
* @throws PrecisionNotKnownException
*/
public function get($ip, $precision)
public function get($ip, $precision = 'city')
{

if ($this->acceptedPrecision($precision)) {
Expand Down

0 comments on commit f0e5361

Please sign in to comment.