coolify/app/Actions/RemoteProcess/DispatchRemoteProcess.php

30 lines
624 B
PHP
Raw Normal View History

2023-03-20 13:04:22 +01:00
<?php
namespace App\Actions\RemoteProcess;
2023-03-20 13:04:22 +01:00
use App\Data\RemoteProcessArgs;
use App\Jobs\ExecuteRemoteProcess;
use Spatie\Activitylog\Models\Activity;
2023-03-20 13:04:22 +01:00
class DispatchRemoteProcess
2023-03-20 13:04:22 +01:00
{
protected Activity $activity;
public function __construct(RemoteProcessArgs $remoteProcessArgs){
2023-03-20 13:04:22 +01:00
$this->activity = activity()
->withProperties($remoteProcessArgs->toArray())
2023-03-27 09:35:34 +02:00
->log("");
2023-03-20 13:04:22 +01:00
}
public function __invoke(): Activity
2023-03-20 13:04:22 +01:00
{
$job = new ExecuteRemoteProcess($this->activity);
2023-03-20 13:04:22 +01:00
dispatch($job);
$this->activity->refresh();
2023-03-20 13:04:22 +01:00
return $this->activity;
}
}