2023-03-20 12:04:22 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Jobs;
|
|
|
|
|
2023-03-21 09:56:49 +00:00
|
|
|
use App\Actions\RemoteProcess\RunRemoteProcess;
|
2023-03-20 12:04:22 +00:00
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
2023-03-21 10:32:38 +00:00
|
|
|
use Spatie\Activitylog\Models\Activity;
|
2023-03-20 12:04:22 +00:00
|
|
|
|
2023-03-21 10:39:44 +00:00
|
|
|
class ExecuteRemoteProcess implements ShouldQueue
|
2023-03-20 12:04:22 +00:00
|
|
|
{
|
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new job instance.
|
|
|
|
*/
|
|
|
|
public function __construct(
|
|
|
|
public Activity $activity,
|
|
|
|
){}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the job.
|
|
|
|
*/
|
2023-03-21 09:08:36 +00:00
|
|
|
public function handle(): void
|
2023-03-20 12:04:22 +00:00
|
|
|
{
|
2023-03-21 09:56:49 +00:00
|
|
|
$remoteProcess = resolve(RunRemoteProcess::class, [
|
2023-03-21 09:08:36 +00:00
|
|
|
'activity' => $this->activity,
|
2023-03-20 14:04:35 +00:00
|
|
|
]);
|
|
|
|
|
2023-03-21 09:08:36 +00:00
|
|
|
$remoteProcess();
|
2023-03-24 21:15:36 +00:00
|
|
|
// @TODO: Remove file at $this->activity->getExtraProperty('private_key_location') after process is finished
|
2023-03-20 12:04:22 +00:00
|
|
|
}
|
|
|
|
}
|