/** * Display a listing of the resource. * * @return Response */ public function index() { $params = Input::get(); $products_d = Product::where('updated_at', '<', date('Y-m-d H:i:s')); foreach ($params as $key => $value) { if ($key != 'page') { $field = ucfirst($key); $field = str_replace('_', '', $field); $searchClass = "Search" . $field . "Product"; $products_d = $searchClass::searchField($key, $value); } } $products = $products_d->orderBy('created_at', 'desc')->paginate(BaseHelper::getItemPerPage()); if (array_key_exists('user', $params)) { $view = View::make('frontend/products/user-products')->with('products', $products)->with('u_name', User::find($products['user_id'])->name); } else { $view = View::make('frontend/products/index')->with('products', $products); } return $view; }
/** * Display a listing of the resource. * * @return Response */ public function index() { // $products = Product::orderBy('created_at', 'desc')->paginate(BaseHelper::getItemPerPage()); return View::make('backend.product.index')->with('products', $products); }