job = $job; $model->data = $data; $model->parent_id = $parentId; $model->rel_type = $relType; $model->rel_id = $relId; $model->custom_id = $customId; $model->save(); return $model; } public function pushRaw($payload, $queue = null, array $options = []) { } public function later($delay, $job, $data = '', $queue = null) { } public function pushOn($queue, $job, $data = '') { } public function laterOn($queue, $delay, $job, $data = '') { } /** * @return mixed */ public function pop() { return $this->query()->first(); } /** * @return mixed */ public function count() { return $this->query()->count(); } /** * @return \ModulesGarden\Servers\ProxmoxCloudVps\Core\Queue\Models\Job */ protected function query() { $table = (new\ModulesGarden\Servers\ProxmoxCloudVps\Core\Queue\Models\Job)->getTable(); $query = \ModulesGarden\Servers\ProxmoxCloudVps\Core\Queue\Models\Job ::select("{$table}.*") ->leftJoin($table.' as parent', function($join) use($table) { $join->on($table.'.parent_id', '=', 'parent.id'); }) ->where(function($query) use($table){ $query->where("{$table}.status", '=', '') ->orWhere(function($query) use($table){ $query->where("{$table}.status", '=', \ModulesGarden\Servers\ProxmoxCloudVps\Core\Queue\Models\Job::STATUS_ERROR); $query->whereRaw("{$table}.retry_after < NOW()"); $query->where("{$table}.retry_count", '<', $this->retryLimit); }) ->orWhere(function($query) use($table){ $query->where("{$table}.status", '=', \ModulesGarden\Servers\ProxmoxCloudVps\Core\Queue\Models\Job::STATUS_WAITING); $query->whereRaw("{$table}.retry_after < NOW()"); $query->where("{$table}.retry_count", '<', $this->retryLimit); }); }) ->where(function($query) use($table){ $query->whereRaw("{$table}.parent_id IS NULL"); $query->orWhere("parent.status", \ModulesGarden\Servers\ProxmoxCloudVps\Core\Queue\Models\Job::STATUS_FINISHED); }); return $query; } }