/**
  * @param string $order_by
  * @param string $sort
  *
  * @return mixed
  */
 public function getAllProducts($order_by = 'id', $sort = 'asc')
 {
     return Product::orderBy($order_by, $sort)->get();
 }
Exemplo n.º 2
0
 public function Product()
 {
     return \Innovate\Products\Product::all();
 }
 /**
  * Handle the command.
  *
  * @param $command
  *
  * @return mixed
  */
 public function handle($command)
 {
     $product = $this->product->post($command->title, $command->description);
     $this->dispatcher->dispatch($product->releaseEvents());
 }
 /**
  * Handle the command.
  *
  * @param $command
  *
  * @return mixed
  */
 public function handle($command)
 {
     $product = $this->product->create($command->input);
     $this->dispatcher->dispatch($product->releaseEvents());
 }
 public function eagerLoadWhere($table, $product_id)
 {
     // $this->raise(new ProductWasPosted(new Product()));
     return Product::with(['category', 'tax', 'product_attribute_category', 'varchar_values', 'text_values', 'int_values', 'product_translations' => function ($query) {
         //$query->orderBy('product.id', $product_id);
         $query->where('product_translations.locale', '=', App::getLocale());
     }])->find($product_id);
 }