lasthourcloud/app/Http/Livewire/PollActivity.php

28 lines
738 B
PHP
Raw Normal View History

<?php
namespace App\Http\Livewire;
use Livewire\Component;
2023-03-31 11:32:07 +00:00
use Spatie\Activitylog\Models\Activity;
class PollActivity extends Component
{
public $activity;
public $isKeepAliveOn = true;
2023-03-31 11:32:07 +00:00
public $deployment_uuid;
public function polling()
{
2023-03-31 11:32:07 +00:00
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;
}
}
}