'required|integer|exists:accounts,id', 'task_id' => 'required|integer', ]; } /** * Destroy a task. * * @param array $data * @return bool */ public function execute(array $data): bool { $this->validate($data); $task = Task::where('account_id', $data['account_id']) ->findOrFail($data['task_id']); // Delete the object in the DB $task->delete(); return true; } }