/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     # returns a list of products in decreasing order by date created
     $products = Product::select('*')->orderBy('created_at', 'desc')->paginate(5);
     return view('skins/skin_b/product/index', ['products' => $products]);
     # return response()->json( Product::all() );
 }
 public function postDetail()
 {
     $return['success'] = 0;
     if (Input::has('id')) {
         $product = Product::select('name_en', 'name_id', 'price', 'masked_price', 'promo_label_en', 'promo_label_id', 'image', 'type', 'created_at as cdate')->find(Input::get('id'));
         if ($product !== null) {
             $return['success'] = 1;
             $data['name_en'] = $product->name_en;
             $data['name_id'] = $product->name_id;
             $data['price'] = $product->price;
             $data['image'] = $product->image;
             $data['type'] = $product->type;
             $data['promo_label_en'] = $product->promo_label_en;
             $data['promo_label_id'] = $product->promo_label_id;
             $data['masked_price'] = $product->masked_price;
             $data['created_at'] = $product->cdate;
             $return['data'] = $data;
         }
     }
     echo json_encode($return);
 }
Example #3
0
 public function ajaxProduct_enable(Request $request)
 {
     $feedId = Input::get('feedid');
     $products = Product::select(array('products.id', 'products.name', 'products.description', 'products.image'))->where('feed_id', Input::get('feedid'));
     return Datatables::of($products)->addColumn('active', function ($products) {
         return '<input type="checkbox" name="disable[]" value="' . $products->id . '">';
     }, 0)->editColumn('image', '<img src="{!! $image !!}" height="50" width="50">')->make();
 }
Example #4
0
 public function getProductsByFullText($rawQuery, $fields, $orderBy, $paginate = false, $pageSize = 25)
 {
     $arrTerms = $this->prepareFullTextSearchQuery($rawQuery);
     $terms = implode(' ', $arrTerms);
     $query = "MATCH (name, description, gtin, mpc, brand, ingredient_deck) AGAINST ('{$terms}' IN BOOLEAN MODE)";
     if ($paginate) {
         $products = Product::select($fields)->whereRaw($query)->orderBy($orderBy)->paginate($pageSize);
     } else {
         $products = Product::select($fields)->whereRaw($query)->orderBy($orderBy)->get();
     }
     return $products;
 }