service = $service; $this->userId = $userId; } /** * @NoAdminRequired * @throws \Exception */ public function index(int $tableId): DataResponse { return new DataResponse($this->service->findAllByTable($this->userId, $tableId)); } /** * @NoAdminRequired */ public function show(int $id): DataResponse { return $this->handleError(function () use ($id) { return $this->service->find($id, $this->userId); }); } /** * @NoAdminRequired * @throws Exception */ public function create( int $tableId, int $columnId, string $data ): DataResponse { return new DataResponse($this->service->create( $tableId, $columnId, $this->userId, $data)); } /** * @NoAdminRequired * @throws Exception */ public function createComplete( int $tableId, Array $data ): DataResponse { return new DataResponse($this->service->createComplete( $tableId, $this->userId, $data)); } /** * @NoAdminRequired */ public function update( int $id, int $columnId, string $data ): DataResponse { return $this->handleError(function () use ( $id, $columnId, $data ) { return $this->service->update( $id, $columnId, $this->userId, $data); }); } /** * @NoAdminRequired */ public function updateSet( int $id, array $data ): DataResponse { return $this->handleError(function () use ( $id, $data ) { return $this->service->updateSet( $id, $this->userId, $data); }); } /** * @NoAdminRequired */ public function destroy(int $id): DataResponse { return $this->handleError(function () use ($id) { return $this->service->delete($id, $this->userId); }); } }