coolify/app/Jobs/CoolifyTask.php

39 lines
895 B
PHP
Raw Normal View History

2023-03-20 13:04:22 +01:00
<?php
namespace App\Jobs;
2023-05-03 07:15:45 +02:00
use App\Actions\CoolifyTask\RunRemoteProcess;
2023-03-20 13:04:22 +01:00
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;
2023-03-20 13:04:22 +01:00
2023-05-03 08:24:34 +02:00
class CoolifyTask implements ShouldQueue
2023-03-20 13:04:22 +01:00
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct(
public Activity $activity,
public bool $ignore_errors = false,
2023-08-11 20:48:52 +02:00
) {
2023-05-24 15:25:08 +02:00
}
2023-03-20 13:04:22 +01:00
/**
* Execute the job.
*/
public function handle(): void
2023-03-20 13:04:22 +01:00
{
2023-05-24 15:25:08 +02:00
$remote_process = resolve(RunRemoteProcess::class, [
'activity' => $this->activity,
2023-06-07 15:39:08 +02:00
'ignore_errors' => $this->ignore_errors,
]);
2023-05-24 15:25:08 +02:00
$remote_process();
2023-03-20 13:04:22 +01:00
}
}