Ad

Laravel Use SSH In Controller

- 1 answer

Im trying to use SSH:: command in my controller but I'm facing error:

Class 'SSH' not found

my controller:

namespace App\Http\Controllers;

use Session;
use DB;
use SSH;

and call action:

SSH::run(
            array(
                'cd /var/www/laravel',
                'node accept.js '
            )
        );

so where the problem could be?

Ad

Answer

You need to follow the installation guide of Laravel SSH package:

1. Install it via Composer:

Add this to your composer.json:

"require": {
  "laravelcollective/remote": "~5.0"
}

Then run composer update.

2. Add new provider to the providers array of config/app.php:

'providers' => [
  // ...
  'Collective\Remote\RemoteServiceProvider',
  // ...
],

3. Add two class aliases to the aliases array of config/app.php:

'aliases' => [
  // ...
  'SSH' => 'Collective\Remote\RemoteFacade',
  // ...
],
Ad
source: stackoverflow.com
Ad