I have a command like this
class TestCommand extends Command {
.....
constructor
.....
public function handle()
{
....
command logic
....
}
}
the TestCommand
is registered in the Kernel.php
also.
now I need to extend TestCommand
,
class ExtendedCommand extends TestCommand {
public function __construct ()
{
parent::__constrct();
.....
modify some variables
.....
}
public function sync()
{
//trying to call the parent class handle method.
$this->handle(); // not working & getting PHP Error: Call to a member function getOption() on null in /home/vagrant/sinbad/vendor/laravel/framework/src/Illuminate/Console/Command.php on line 292
$this->execute(); // obviously not working & getting TypeError: Too few arguments to function Illuminate\Console\Command::execute(),
}
}
//instantiating the new command
new(ExtendedCommand)->sync();
Now I need to call the ExtendedCommand
what are the possible ways I can do it? a solution without registering this command in the kernel.php
would be better, cause I am not looking for an Artisan::call
way.