repository = $repository; } /** * Determines if a user can delete the task for a given server. * * @param \Pterodactyl\Http\Requests\Api\Client\ClientApiRequest $request * @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Schedule $schedule * @param \Pterodactyl\Models\Task $task * @return \Illuminate\Http\JsonResponse */ public function delete(ClientApiRequest $request, Server $server, Schedule $schedule, Task $task) { if ($task->schedule_id !== $schedule->id || $schedule->server_id !== $server->id) { throw new NotFoundHttpException; } if (! $request->user()->can(Permission::ACTION_SCHEDULE_UPDATE, $server)) { throw new HttpForbiddenException('You do not have permission to perform this action.'); } $this->repository->delete($task->id); return JsonResponse::create(null, Response::HTTP_NO_CONTENT); } }