because ssh method is called before view rendering, and ssh method echoes $line. You could put $line on Session and retrieve it in view.
It`s not possible to view ssh output in view?
Best Regards Z!nni
$line is ssh output, you could put $line.PHP_EOL on session or do something like this:
<?php
class DeviceController extends BaseController {
public function get_index() {
return View::make('device.index')
->with('output', $this->ssh());
}
public function ssh() {
$commands = 'ls';
$output = "";
SSH::run($commands, function($line) use (&$output)
{
$output = $line.PHP_EOL;
});
return $output;
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community