Q:

Extending Laravel's core component

In my project there is a need to extend laravel's generator component. I need it to allow to put in path option so the file would be generated in a location that user would specify. I need this for all generators - from Controllers to Requests etc.
Any hint to where I should start would be much appreciated, thanks
Update:
I found out that I have to modify Illuminate\Console\GeneratorCommand and specifically getPath method. How would I override this class?
Basically, all core generators extend this class so I need them to extend my new class somehow..

A:

You cannot change the class those commands extend.
You have 4 options:

GeneratorCommand uses a Filesystem object it gets from container to save files. You can extend Filesystem with your own class and overwrite its methods so that they write where you need them too. Be aware that this will impact all other code that uses this Filesystem service.
Extend all XYZMakeCommand classes with your own ones, set a different command name (e.g. my:make-controller) and inside overwrite getPath() method, e.g.:
class MyControllerMakeCommand extends ControllerMakeCommand {
  protected $name = 'my:make-controller';

  protected function getPath($name) {
    //return the path you need
  }
}

Live with the default Laravel's path
After a command is executed copy generated files to where you want to have it

