update
This commit is contained in:
parent
2922dbcce5
commit
9de6becd9e
4 changed files with 92 additions and 2 deletions
|
@ -4,6 +4,8 @@ namespace App\Listeners;
|
|||
|
||||
|
||||
use App\Events\ModelPhyreServerCreated;
|
||||
use Illuminate\Remote\Connection;
|
||||
use Spatie\Ssh\Ssh;
|
||||
|
||||
class ModelPhyreServerCreatedListener
|
||||
{
|
||||
|
@ -21,7 +23,15 @@ class ModelPhyreServerCreatedListener
|
|||
public function handle(ModelPhyreServerCreated $event): void
|
||||
{
|
||||
|
||||
dd($event);
|
||||
$username = $event->model->username;
|
||||
$password = $event->model->password;
|
||||
$ip = $event->model->ip;
|
||||
|
||||
$process = Ssh::create($username . ':' . $password, $ip)
|
||||
->enablePasswordAuthentication()
|
||||
->execute('ls');
|
||||
|
||||
dd($process->getOutput());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,30 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Events\ModelPhyreServerCreated;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PhyreServer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'ip',
|
||||
'port',
|
||||
'username',
|
||||
'password',
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
event(new ModelPhyreServerCreated($model));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"mkocansey/bladewind": "^2.4",
|
||||
"nwidart/laravel-modules": "^10.0",
|
||||
"outerweb/filament-settings": "^1.2",
|
||||
"spatie/ssh": "^1.10",
|
||||
"symfony/process": "^6.3",
|
||||
"symfony/yaml": "^7.0",
|
||||
"tapp/filament-authentication-log": "^3.0",
|
||||
|
|
61
web/composer.lock
generated
61
web/composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "4abe345fdbef63cc6393bf28582dc8cf",
|
||||
"content-hash": "ba2b3ac0d17f502cef5560e3baecf9d0",
|
||||
"packages": [
|
||||
{
|
||||
"name": "acmephp/core",
|
||||
|
@ -6266,6 +6266,65 @@
|
|||
],
|
||||
"time": "2024-03-20T07:29:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/ssh",
|
||||
"version": "1.10.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/ssh.git",
|
||||
"reference": "8a69221ec27112bf463e6da78b21f17c047abd75"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/ssh/zipball/8a69221ec27112bf463e6da78b21f17c047abd75",
|
||||
"reference": "8a69221ec27112bf463e6da78b21f17c047abd75",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4|^8.0",
|
||||
"symfony/process": "^4.4|^5.3|^6.0|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"pestphp/pest": "^1.22",
|
||||
"spatie/pest-plugin-snapshots": "^1.1",
|
||||
"symfony/var-dumper": "^5.3|6.0|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Spatie\\Ssh\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Freek Van der Herten",
|
||||
"email": "freek@spatie.be",
|
||||
"homepage": "https://spatie.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A lightweight package to execute commands over an SSH connection",
|
||||
"homepage": "https://github.com/spatie/ssh",
|
||||
"keywords": [
|
||||
"spatie",
|
||||
"ssh"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/ssh/issues",
|
||||
"source": "https://github.com/spatie/ssh/tree/1.10.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://spatie.be/open-source/support-us",
|
||||
"type": "custom"
|
||||
}
|
||||
],
|
||||
"time": "2024-04-05T09:15:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "swagger-api/swagger-ui",
|
||||
"version": "v5.13.0",
|
||||
|
|
Loading…
Reference in a new issue