Files
ploi-core/app/Jobs/Cronjobs/DeleteCronjob.php
2021-09-23 08:27:27 +02:00

48 lines
1.0 KiB
PHP

<?php
namespace App\Jobs\Cronjobs;
use App\Traits\HasPloi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class DeleteCronjob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasPloi;
public $serverPloiId;
public $cronjobPloiId;
/**
* Create a new job instance.
*
* @param $serverPloiId
* @param $cronjobPloiId
*/
public function __construct($serverPloiId, $cronjobPloiId)
{
$this->cronjobPloiId = $cronjobPloiId;
$this->serverPloiId = $serverPloiId;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
if (!$this->serverPloiId || !$this->cronjobPloiId) {
return;
}
$this->getPloi()
->server($this->serverPloiId)
->cronjobs()
->delete($this->cronjobPloiId);
}
}