Support the ongoing development of Laravel.io →
Views Blade Packages
Last updated 2 years ago.
0

because ssh method is called before view rendering, and ssh method echoes $line. You could put $line on Session and retrieve it in view.

Last updated 2 years ago.
0

It`s not possible to view ssh output in view?

Best Regards Z!nni

Last updated 2 years ago.
0

$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;
    }

}
Last updated 2 years ago.
0

THANK YOU SO MUUUUUUCH!!!!!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.