public function store(ProductCreationRequest $request) { if ($this->max and $this->account()->products()->count() >= $this->max) { throw new InvalidDataException('最多添加' . $this->max . '个商品'); } $product = $this->productManager->createProduct($this->account(), $request->all()); $this->flashSuccess('add'); return $this->redirectRoute('products.edit', $product->id); }