logger = $logger; $this->service = $service; $this->userId = $userId; } /** * @NoAdminRequired */ public function index(): DataResponse { return $this->handleError(function () { return $this->service->findAll($this->userId); }); } /** * @NoAdminRequired */ public function show(int $id): DataResponse { return $this->handleError(function () use ($id) { return $this->service->find($id); }); } /** * @NoAdminRequired */ public function create(string $title, string $template, string $emoji): DataResponse { return $this->handleError(function () use ($title, $template, $emoji) { return $this->service->create($title, $template, $emoji); }); } /** * @NoAdminRequired */ public function destroy(int $id): DataResponse { return $this->handleError(function () use ($id) { return $this->service->delete($id); }); } /** * @NoAdminRequired */ public function update(int $id, string $title = null, string $emoji = null, ?bool $archived = null): DataResponse { return $this->handleError(function () use ($id, $title, $emoji, $archived) { return $this->service->update($id, $title, $emoji, $archived, $this->userId); }); } }