diff --git a/.env.example b/.env.example index 2d1db72861cc..55c90496ae2c 100644 --- a/.env.example +++ b/.env.example @@ -46,6 +46,7 @@ API_SECRET=password #GOOGLE_CLIENT_SECRET= #GOOGLE_OAUTH_REDIRECT=http://ninja.dev/auth/google +GOOGLE_MAPS_ENABLED=true #GOOGLE_MAPS_API_KEY= #S3_KEY= diff --git a/app/Models/Client.php b/app/Models/Client.php index 02da4dc912a5..92cabf0bc89c 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -379,6 +379,14 @@ class Client extends EntityModel return ENTITY_CLIENT; } + /** + * @return bool + */ + public function showMap() + { + return $this->hasAddress() && env('GOOGLE_MAPS_ENABLED') !== false; + } + /** * @return bool */ diff --git a/app/Models/Vendor.php b/app/Models/Vendor.php index addf98e1d1ec..466c6cc8fa47 100644 --- a/app/Models/Vendor.php +++ b/app/Models/Vendor.php @@ -267,6 +267,14 @@ class Vendor extends EntityModel return 'vendor'; } + /** + * @return bool + */ + public function showMap() + { + return $this->hasAddress() && env('GOOGLE_MAPS_ENABLED') !== false; + } + /** * @return bool */ diff --git a/resources/views/clients/show.blade.php b/resources/views/clients/show.blade.php index fe5c88e6ab3c..23c60e272e87 100644 --- a/resources/views/clients/show.blade.php +++ b/resources/views/clients/show.blade.php @@ -6,7 +6,7 @@ - @if ($client->hasAddress()) + @if ($client->showMap())