mikebronner / Phpgmaps

Larvel 5 implementation of BIOSTALL/CodeIgniter-Google-Maps-V3-API-Library.
MIT License
27 stars 14 forks source link

It Gives this error in Laravel 5.4 #8

Closed oliveiraped closed 7 years ago

oliveiraped commented 7 years ago

It Gives this error in Laravel 5.4

"Call to undefined method Illuminate\Foundation\Application::share()"

public function register()
{
    $this->app['phpgmaps'] = $this->app->share(function () {
        $phpgmaps = new Phpgmaps();
        $phpgmaps->apiKey = config('services.google.maps.api-key');

        return $phpgmaps;
    });
}

/**
 * Get the services provided by the provider.
 *
 * @return array
 */
public function provides()
{
    return array('phpgmaps');
}

}

Arguments

mikebronner commented 7 years ago

@oliveiraped thanks for the error report! I will look into this today. :)

oliveiraped commented 7 years ago

@sickaustrian As of laravel 5.4 share has been removed. You will have to use the singleton instead.

See: https://github.com/laravel/framework/commit/1a1969b6e6f793c3b2a479362641487ee9cbf736

oliveiraped commented 7 years ago

But i Tried with singleton and gives me another error

mikebronner commented 7 years ago

Yea, I knew they had been removed, and forgot this package used them. :)

mikebronner commented 7 years ago

@oliveiraped Can you provide the following information for me:

Laravel Version: PHP Version (in Homestead or server): Phpgmaps Version:

I am running this package without issue on a 5.4 project and suspect you might have an old version or an older version of Laravel? The latest version is using singleton: https://github.com/GeneaLabs/Phpgmaps/blob/master/src/GeneaLabs/Phpgmaps/PhpgmapsServiceProvider.php#L33 (Looks like I forgot that I had already updated it.)

oliveiraped commented 7 years ago

{ "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel", "boilerplate" ], "license": "MIT", "type": "project", "require": { "php": ">=5.6.4", "anahkiasen/former": "^4.1", "arcanedev/log-viewer": "~4.0", "arcanedev/no-captcha": "~3.0", "barryvdh/laravel-ide-helper": "^2.3", "consoletvs/charts": "4.", "creativeorange/gravatar": "~1.0", "davejamesmiller/laravel-breadcrumbs": "^3.0", "garygreen/pretty-routes": "^0.0.6", "geoip2/geoip2": "^2.5", "graham-campbell/exceptions": "^9.3", "graham-campbell/flysystem": "^3.7", "graham-campbell/htmlmin": "^4.5", "guzzlehttp/guzzle": "^6.2", "hieu-le/active": "~3.0", "intervention/image": "^2.3", "itsgoingd/clockwork": "~1.14", "jeroennoten/laravel-ckeditor": "^3.8", "laravel/framework": "5.4.", "laravel/socialite": "^3.0", "laravel/tinker": "~1.0", "laravelcollective/html": "5.4.", "lsrur/inspector": "^1.0", "pragmarx/countries": "^0.1.0", "proengsoft/laravel-jsvalidation": "^1.6.0-dev", "spatie/laravel-menu": "^2.1", "torann/geoip": "^1.0", "tymon/jwt-auth": "^0.5.11", "yajra/laravel-datatables-oracle": "^7.0", "cornford/googlmapper": "2.", "genealabs/phpgmaps": "~0.3.0"

},
"require-dev": {
    "barryvdh/laravel-debugbar": "^2.1",
    "filp/whoops": "^2.1",
    "fzaninotto/faker": "~1.4",
    "laravel/browser-kit-testing": "^1.0",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~5.7",
    "satooshi/php-coveralls": "^1.0"
},
"repositories": [
    {
       "type": "vcs",
        "url": "https://github.com/reganjohnson/laravel-jsvalidation"
    }
],
"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    },
    "files": [
        "app/helpers.php"
    ]
},
"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
    },
    "classmap": [
        "tests/TestCase.php",
        "tests/BrowserKitTestCase.php"
    ]
},
"scripts": {
    "post-root-package-install": [
        "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ],
    "post-install-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postInstall",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postUpdate",
        "php artisan vendor:publish --provider=\"Proengsoft\\JsValidation\\JsValidationServiceProvider\" --tag=public --force",
        "php artisan ide-helper:generate",
        "php artisan ide-helper:meta",
        "php artisan optimize"
    ]
},
"config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
}

}

oliveiraped commented 7 years ago

my Ubuntu Machine

HP 7.0.18-0ubuntu0.16.04.1 (cli) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.18-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

mikebronner commented 7 years ago

yea, the 0.30 is bad, use "genealabs/phpgmaps": "~0.4.0"

mikebronner commented 7 years ago

I fixed the documentation in the readme to reflect the proper installation command, sorry about that.

mikebronner commented 7 years ago

If that worked for you, go ahead and close the issue (I hope it did!) ;)

oliveiraped commented 7 years ago

Nice Thanks Alot. Keep up the good Work.

mikebronner commented 7 years ago

Thanks :) sorry for the documentation being so shoddy. I am planning to rewrite the entire package, as I inherited it, and haven't really done much with it other than make sure it runs. Want to optimize it and get the documentation cleaned up. :)

Glad you are back up and running!