service = $service; $this->userId = $userId; } /** * @NoAdminRequired */ public function index(): DataResponse { return $this->handleError(function () { return $this->service->findAll(); }); } /** * @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): DataResponse { return $this->handleError(function () use ($title, $template) { return $this->service->create($title, $template); }); } /** * @NoAdminRequired */ public function update(int $id, string $title): DataResponse { return $this->handleError(function () use ($id, $title) { return $this->service->update($id, $title, $this->userId); }); } /** * @NoAdminRequired */ public function destroy(int $id): DataResponse { return $this->handleError(function () use ($id) { return $this->service->delete($id); }); } }