Created
January 30, 2019 22:21
-
-
Save aaronkaz/44586f270410d011dc3d93f960c046e7 to your computer and use it in GitHub Desktop.
Monkey-path fix for Call to undefined method Laravel\Lumen\Application::configPath()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Register any application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
// | |
$this->app->register(GeneratorsServiceProvider::class); | |
$this->app->register(MigrationsGeneratorServiceProvider::class); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use Way\Generators\GeneratorsServiceProvider as BaseProvider; | |
class GeneratorsServiceProvider extends BaseProvider | |
{ | |
/** | |
* Register the config paths | |
*/ | |
public function registerConfig() | |
{ | |
$userConfigFile = config_path().'/generators.config.php'; | |
$packageConfigFile = base_path().'/vendor/xethron/laravel-4-generators/src/config/config.php'; | |
$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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use Xethron\MigrationsGenerator\MigrateGenerateCommand as BaseCommand; | |
class MigrateGenerateCommand extends BaseCommand | |
{ | |
/** | |
* Get a directory path through a command option, or from the configuration. | |
* | |
* @param $option | |
* @param $configName | |
* @return string | |
*/ | |
protected function getPathByOptionOrConfig($option, $configName) | |
{ | |
if ($path = $this->option($option)) return $path; | |
return config()->get("generators.config.{$configName}"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use Xethron\MigrationsGenerator\MigrationsGeneratorServiceProvider as BaseProvider; | |
class MigrationsGeneratorServiceProvider extends BaseProvider | |
{ | |
public function register() | |
{ | |
$this->app->singleton('migration.generate', | |
function($app) { | |
return new MigrateGenerateCommand( | |
$app->make('Way\Generators\Generator'), | |
$app->make('Way\Generators\Filesystem\Filesystem'), | |
$app->make('Way\Generators\Compilers\TemplateCompiler'), | |
$app->make('migration.repository'), | |
$app->make('config') | |
); | |
}); | |
$this->commands('migration.generate'); | |
// Bind the Repository Interface to $app['migrations.repository'] | |
$this->app->bind('Illuminate\Database\Migrations\MigrationRepositoryInterface', function($app) { | |
return $app['migration.repository']; | |
}); | |
} | |
} |
Is the file MigrateGenerateCommand.php
should be placed in app\Providers
folder too?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fix for Xethron/migrations-generator#166