public function update($id, $name, $price, $active, $thumb, $content) { Assertion::string($name); Assertion::boolean($active); $product = $this->products->productOfId($id); $product->name = $name; $product->slug = Str::slug($name); $product->price = $price; $product->active = $active; if ($thumb) { $product->thumb = $thumb; } $product->content = $content; $this->products->update($product); return $product; }
public function getDataTables() { $products = $this->productRepository->getByPage(Input::get('start'), Input::get('length')); return $this->respond(['draw' => Input::get('raw'), "recordsTotal" => 7, 'data' => $this->transformCollection($products->items)]); }