migrations-generator icon indicating copy to clipboard operation
migrations-generator copied to clipboard

Call to undefined method Laravel\Lumen\Application::configPath()

Open vt-nwei opened this issue 6 years ago • 7 comments

Lumen
"laravel/lumen-framework": "5.5.*",

vt-nwei avatar May 31 '18 03:05 vt-nwei

the same

terranc avatar Sep 10 '18 14:09 terranc

too. After istalling Xethron/migrations-generator and registering service provider

rizhenkov avatar Oct 08 '18 17:10 rizhenkov

#MeToo

Lumen: 5.7.*

kalimulhaq avatar Oct 13 '18 12:10 kalimulhaq

Nice, 20 days and no solution :(

Guess we have to add them manually!

angelovancleef avatar Nov 02 '18 10:11 angelovancleef

hey @angelovancleef did you found a solution ? Can you share it ? :)

nicolasrz avatar Jan 14 '19 21:01 nicolasrz

I did a stack trace and made some monkey-patches to get it working for me (lumen 5.5)

Here's the gist https://gist.github.com/aaronkaz/44586f270410d011dc3d93f960c046e7

aaronkaz avatar Jan 30 '19 22:01 aaronkaz

my solution for this is simple :

  1. Create a new laravel service provider in your application like this:
namespace App\Providers;

use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
use Way\Generators\GeneratorsServiceProvider; // IMPORTANT !!

class GeneratorsFixer **extends GeneratorsServiceProvider**  // IMPORTANT !!
{
	/**
	 * Register the config paths
	 */
	public function registerConfig()
	{
		$userConfigFile    = config_path().'/generators.config.php'; // IMPORTANT !!
		$packageConfigFile = base_path().'/vendor/xethron/laravel-4-generators/src/config/config.php'; // IMPORTANT !!
		$config            = $this->app['files']->getRequire($packageConfigFile);

		if (file_exists($userConfigFile)) {
			$userConfig = $this->app['files']->getRequire($userConfigFile);
			$config     = array_replace_recursive($config, $userConfig);
		}

		$this->app['config']->set('generators.config', $config);
	}
}
  1. register and replace the Way\Generators\GeneratorsServiceProvider by your custom service provider (in our case it's \App\Providers\GeneratorsFixer::class) in your AppServiceprovider.

that's all :)

sohaieb avatar Dec 25 '19 15:12 sohaieb