2023-03-20 12:04:22 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Jobs;
|
|
|
|
|
2023-05-03 06:15:45 +01:00
|
|
|
use App\Actions\CoolifyTask\RunRemoteProcess;
|
2023-03-20 12:04:22 +00:00
|
|
|
use Illuminate\Bus\Queueable;
|
2023-09-14 10:12:44 +02: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;
|
2023-03-21 10:32:38 +00:00
|
|
|
use Spatie\Activitylog\Models\Activity;
|
2023-03-20 12:04:22 +00:00
|
|
|
|
2023-09-14 10:12:44 +02:00
|
|
|
class CoolifyTask implements ShouldQueue, ShouldBeEncrypted
|
2023-03-20 12:04:22 +00:00
|
|
|
{
|
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new job instance.
|
|
|
|
*/
|
|
|
|
public function __construct(
|
|
|
|
public Activity $activity,
|
2023-08-08 11:51:36 +02:00
|
|
|
public bool $ignore_errors = false,
|
2023-12-08 12:12:44 +01:00
|
|
|
public $call_event_on_finish = null
|
2023-08-11 20:48:52 +02:00
|
|
|
) {
|
2023-05-24 15:25:08 +02:00
|
|
|
}
|
2023-03-20 12:04:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the job.
|
|
|
|
*/
|
2023-03-21 09:08:36 +00:00
|
|
|
public function handle(): void
|
2023-03-20 12:04:22 +00:00
|
|
|
{
|
2023-05-24 15:25:08 +02:00
|
|
|
$remote_process = resolve(RunRemoteProcess::class, [
|
2023-03-21 09:08:36 +00:00
|
|
|
'activity' => $this->activity,
|
2023-06-07 15:39:08 +02:00
|
|
|
'ignore_errors' => $this->ignore_errors,
|
2023-12-08 12:12:44 +01:00
|
|
|
'call_event_on_finish' => $this->call_event_on_finish
|
2023-03-20 14:04:35 +00:00
|
|
|
]);
|
|
|
|
|
2023-05-24 15:25:08 +02:00
|
|
|
$remote_process();
|
2023-03-20 12:04:22 +00:00
|
|
|
}
|
|
|
|
}
|