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