getBuilder()->withCount('tasks')->where('server_id', '=', $server)->get($this->getColumns()); } /** * Return a schedule model with all the associated tasks as a relationship. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function getScheduleWithTasks(int $schedule): Schedule { try { return $this->getBuilder()->with('tasks')->findOrFail($schedule, $this->getColumns()); } catch (ModelNotFoundException) { throw new RecordNotFoundException(); } } }