service = $service; $this->userId = $UserId; } /** * @CORS * @NoCSRFRequired * @NoAdminRequired */ public function index() { return new DataResponse($this->service->findAll($this->userId)); } /** * @CORS * @NoCSRFRequired * @NoAdminRequired * * @param int $id */ public function show($id) { return $this->handleNotFound(function () use ($id) { return $this->service->find($id, $this->userId); }); } /** * @CORS * @NoCSRFRequired * @NoAdminRequired * * @param string $name */ public function create($name) { return $this->service->create($name, $this->userId); } /** * @CORS * @NoCSRFRequired * @NoAdminRequired * * @param int $id * @param string $name */ public function update($id, $name) { return $this->handleNotFound(function () use ($id, $name) { return $this->service->update($id, $name, $this->userId); }); } /** * @CORS * @NoCSRFRequired * @NoAdminRequired * * @param int $id */ public function destroy($id) { return $this->handleNotFound(function () use ($id) { return $this->service->delete($id, $this->userId); }); } } ?>