Added system polling

This commit is contained in:
2023-07-26 19:44:07 +10:00
parent c23b5ebfc2
commit 4e44e2e266
19 changed files with 733 additions and 88 deletions

View File

@@ -7,6 +7,8 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use App\Jobs\AddressPoll;
class System extends Model
{
use HasFactory;
@@ -214,4 +216,13 @@ class System extends Model
return ($item->role & $type) && ($myzones->search($item->zone_id) !== FALSE);
});
}
public function poll(): ?Job
{
return Job::where('queue',AddressPoll::QUEUE)
->get()
->where(function($item) {
return $this->akas->pluck('id')->search($item->command->address->id) !== FALSE; })
->last();
}
}