How to swap Filesystem for GeneratorCommand #35936
Answered
by
dillingham
dillingham
asked this question in
Q&A
Replies: 1 comment
-
$files = $this->app['files'];
$this->app->beforeResolving('command.controller.make', function ($abstract, $parameters, $container) {
$container->bind('files', function() {
return new Override;
});
});
$this->app->afterResolving('command.controller.make', function ($command, $container) use($files) {
$container->bind('files', function() use($files) {
return $files;
});
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dillingham
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Within the Artisan Service provider:
Illuminate/Foundation/Providers/ArtisanServiceProvider.php
Is building up a class that extends:
Illuminate/Console/GeneratorCommand.php
My question is, is there a way to replace the bindings
$app['files']
for that command / all GeneratorCommands? But not replace Filesystem anywhere else? I want to extend it like:I need a way to listen to File::put in generator classes
So also open to other approaches.. this is the best I came up with.
https://stackoverflow.com/questions/65771232/how-to-swap-filesystem-for-generatorcommand
Beta Was this translation helpful? Give feedback.
All reactions