Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Method Call Exception - Method Illuminate\Foundation\Application::share does not exist. #389

Open
syarifuddinahmads opened this issue Nov 20, 2022 · 0 comments

Comments

@syarifuddinahmads
Copy link

i am using laravel version 9.* and implementing the package you made, where i found the error

in this section the share method method is not recognized

public function register()
	{
		$configPath = __DIR__ . '/../../config/config.php';
		$this->mergeConfigFrom($configPath, 'googlmapper');

		$this->app['mapper'] = $this->app->share(function($app)
		{
			return new Mapper(
				$this->app->view,
				$app['config']->get('googlmapper')
			);
		});
	}

and the solution i have to replace it by directly calling like this

public function register()
	{
		$configPath = __DIR__ . '/../../config/config.php';
		$this->mergeConfigFrom($configPath, 'googlmapper');

		$this->app['mapper'] = function($app)
		{
			return new Mapper(
				$this->app->view,
				$app['config']->get('googlmapper')
			);
		};
	}

Is there another better solution, so you don't need to change on the part of the vendor, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant