Skip to content

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

@syarifuddinahmads

Description

@syarifuddinahmads

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions