lasthourcloud/app/Http/Livewire/PollActivity.php
Andras Bacsai d947175e4b wip
2023-04-19 12:42:15 +02:00

28 lines
738 B
PHP

<?php
namespace App\Http\Livewire;
use Livewire\Component;
use Spatie\Activitylog\Models\Activity;
class PollActivity extends Component
{
public $activity;
public $isKeepAliveOn = true;
public $deployment_uuid;
public function polling()
{
if ( is_null($this->activity) && isset($this->deployment_uuid)) {
$this->activity = Activity::where('properties->deployment_uuid', '=', $this->deployment_uuid)
->first();
} else {
$this->activity?->refresh();
}
if (data_get($this->activity, 'properties.status') == 'finished' || data_get($this->activity, 'properties.status') == 'failed' ) {
$this->isKeepAliveOn = false;
}
}
}