Refactoring: extract process handling from async job.

This commit is contained in:
Joao Patricio
2023-03-21 10:39:44 +00:00
parent 29fb40bd16
commit 0d3b493a76
2 changed files with 3 additions and 3 deletions

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Jobs;
use App\Actions\RemoteProcess\RunRemoteProcess;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Spatie\Activitylog\Models\Activity;
class ExecuteRemoteProcess implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct(
public Activity $activity,
){}
/**
* Execute the job.
*/
public function handle(): void
{
$remoteProcess = resolve(RunRemoteProcess::class, [
'activity' => $this->activity,
]);
$remoteProcess();
}
}