我有一个队列。在完成所有任务之后,我想执行这个函数。示例
队列: Task1 Task2 Task3 Task4 Task5
在这里,当队列为空时,我们必须运行函数。文档只有在每个任务之后触发的事件。
发布于 2022-04-06 12:28:13
嘿,亚历克斯,如果表作业是空的,你可以使用Livewire请求全部3秒。当表为空时,您可以触发一个函数。
带电控制器:
public string $filename;
public mixed $errorlist = [];
public bool $showLoadSequence = True;
public function getError()
{
// check if job table is empy
if (!DB::table('jobs')->exists() && $this->showLoadSequence === True) {
$this->showLoadSequence = False;
// call to action!
}
$errors = ValidationResult::where('file_name', '=', $this->filename)
->where('isValid', false)
->get();
if (count($errors) !== count($this->errorlist)) {
$this->errorlist = $errors;
}
}
public function render()
{
return view('livewire.error-loader');
}
活丝刀片:
<div wire:poll.3s="getError">
//html tags
</div>
https://stackoverflow.com/questions/67581651
复制相似问题