{
$line.PHP_EOL;
});
doesn't actually do anything, add a return before it
I've tried to add a return before the command, but the result it's the same thing. Now my command is:
public function getExecute()
{
if(\Request::ajax()):
$ssh_command = \Input::get('ssh_command');
$ssh_response = null;
\SSH::run($ssh_command, function($line)
{
return $line.PHP_EOL;
});
endif;
}
Finally solved! Solution below:
First i've created a variable called $output in my class.
private $output;
Then i modified my method to this:
public function postExecute()
{
$ssh_command = \Input::get('ssh_command');
$ssh_response = \SSH::run($ssh_command, function($line)
{
$this->output = $line.PHP_EOL;
});
return $this->output;
}
And it WORKS! Now all that i have to do is rollback to my ajax method like before. Thanks for all!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community