lasthourcloud/app/Jobs/CoolifyTask.php

43 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2023-03-20 12:04:22 +00:00
<?php
namespace App\Jobs;
2023-05-03 05:15:45 +00:00
use App\Actions\CoolifyTask\RunRemoteProcess;
2023-03-20 12:04:22 +00:00
use Illuminate\Bus\Queueable;
2023-09-14 08:12:44 +00:00
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
2023-03-20 12:04:22 +00:00
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Spatie\Activitylog\Models\Activity;
2023-03-20 12:04:22 +00:00
2024-06-10 20:43:34 +00:00
class CoolifyTask implements ShouldBeEncrypted, 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,
public bool $ignore_errors,
public $call_event_on_finish,
public $call_event_data,
2024-06-25 08:52:24 +00:00
) {}
2023-03-20 12:04:22 +00:00
/**
* Execute the job.
*/
public function handle(): void
2023-03-20 12:04:22 +00:00
{
2023-05-24 13:25:08 +00:00
$remote_process = resolve(RunRemoteProcess::class, [
'activity' => $this->activity,
2023-06-07 13:39:08 +00:00
'ignore_errors' => $this->ignore_errors,
'call_event_on_finish' => $this->call_event_on_finish,
2024-06-10 20:43:34 +00:00
'call_event_data' => $this->call_event_data,
]);
2023-05-24 13:25:08 +00:00
$remote_process();
2023-03-20 12:04:22 +00:00
}
}