Example #1
0
 /**
  * By Category
  * @param type $query
  * @param \Claremontdesign\Ecommerce\Model\Category $category
  * @return type
  */
 public function scopeCategorized($query, Category $category = null)
 {
     if (is_null($category)) {
         return $query->with(cd_config('database.e.productCategory.table.name'));
     }
     $categoryIds = $category->getDescendantsAndSelf()->lists(cd_config('database.e.productCategory.table.primary'));
     return $query->with('categories')->join(cd_config('database.e.productCategoryPivot.table.name'), cd_config('database.e.productCategoryPivot.table.name') . '.' . cd_config('database.e.product.table.primary'), '=', cd_config('database.e.product.table.name') . '.' . cd_config('database.e.product.table.primary'))->whereIn(cd_config('database.e.productCategoryPivot.table.name') . '.' . cd_config('database.e.productCategory.table.primary'), $categoryIds);
 }
Example #2
0
 /**
  * 
  * @param array $data
  * @param type $id
  * @return type
  */
 public function update(array $data, $id)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         return $this->repository->update($data, $id);
     } catch (ValidatorException $e) {
         return ['error' => 'true', 'messege' => $e->getMessageBag()];
     } catch (\Exception $e) {
         return ['error' => 'true', 'messege' => "Usuário não encontrado!"];
     }
 }
Example #3
0
 /**
  * 
  * @return type
  */
 public function index()
 {
     //$vendas = $this->vendas->join('clientes', 'vendas.cliente_id', '=', 'clientes.id')->select('clientes.nome')->get();
     $vendas = $this->repository->with(['cliente', 'produto'])->all();
     return view('painel::paginas.vendas', compact('vendas'));
 }
 /**
  * News and Version shared view variables
  * @param type $view
  */
 public function compose($view)
 {
     $view->with('senApiVersion', (new \Sentora\Providers\SentoraPublicApi())->latestStableVersion());
     $view->with('senApiNews', (new \Sentora\Providers\SentoraPublicApi())->lastestNews());
 }