model->newQuery(); } public function all(array $columns = ['*']): Collection { return $this->model->all($columns); } public function get(int $modelId): ?Model { return $this->model->find($modelId); } public function add(array $attributes = []): ?Model { return $this->model->create($attributes); } public function edit(int $modelId, array $data): bool { return $this->model->find($modelId)->update($data); } public function delete(int $modelId): bool { return $this->model->find($modelId)->delete(); } public function total(): int { return $this->model->count(); } public function setOutputFormat(string $format): self { $this->outputFormat = $format; return $this; } public function setPage(int $page): self { LengthAwarePaginator::currentPageResolver(fn () => $page); return $this; } public function perPage(int $perPage): self { $this->perPage = $perPage; return $this; } public function deleteJobs(string $queue = null, array $ids = []): int { $query = $this->model->newQuery(); if ($queue) { $query = $query->queuedAt($queue); } if (!empty($ids)) { $query = $query->whereIn('id', $ids); } return $query->delete(); } /** * Show jobs */ abstract public function showJobs(): LengthAwarePaginator; }