public function destroy($templateId, $commandId) { $extra = ['user_id' => parent::id(), 'template_id' => $templateId]; if ($this->commandRepo->delete($commandId, $extra)) { return Response::make(['status' => 'ok'], 200); } return Response::make(['status' => 'error'], 400); }
public function destroy($templateId, $dataStreamId) { if (!$this->templateRepo->isOwner(parent::id(), $templateId)) { return Response::json(['status' => 'Template not found.'], 404); } if ($this->dataStreamRepo->delete($dataStreamId)) { return Response::json(['status' => 'ok'], 200); } return Response::json(['status' => 'error'], 200); }
public function update($id) { $data = Input::only(['name', 'description', 'is_public']); if (!$this->validator->with($data)->passes()) { return Response::json($this->validator->errors(), 400); } try { $extra = ['user_id' => parent::id()]; $device = $this->deviceRepo->update($id, $data, $extra); return Response::json($device, 200); } catch (BeehiveException $e) { return Response::json(['status' => [$e->getMessage()]], $e->getCode()); } }
public function update($id) { $data = Input::all(); if (!$this->validator->with($data)->passes()) { return Response::json($this->validator->errors(), 400); } try { $extra = ['user_id' => parent::id()]; $template = $this->templateRepo->update($id, $data, $extra); return Response::json($template, 200); } catch (BeehiveException $e) { return Response::json(['status' => [$e->getMessage()]], $e->getCode()); } }