/** * Display a listing of the resource. * * @return Response */ public function index() { $pro = new Product(); $adSlotObj = new Adslot(); $catObj = new Category(); $brandObj = new Brand(); /*getting all products for all slots(currently we have 7 slots)*/ $adSlot_data = $adSlotObj->with(['products'])->get(); /*t1-t7*/ // dd($adSlot_data[4]['products'][0]); $category_temp_data = $catObj->orderBy('created_at')->take(10)->get(); /*f1-f10*/ $brand_data = $brandObj->with(['products'])->get(); $category_data = []; foreach ($category_temp_data as $cat_id) { $cat_latest_product = $pro->where('category_id', '=', $cat_id['id'])->orderBy('created_at')->take(1)->pluck('photo_1'); $cat_latest_product_id = $pro->where('category_id', '=', $cat_id['id'])->orderBy('created_at')->take(1)->pluck('id'); $cat_random_product = $pro->where('category_id', '=', $cat_id['id'])->orderBy(DB::raw('RAND()'))->take(6)->get(); $cat_brands = $pro->with(['brand'])->where('category_id', '=', $cat_id['id'])->take(5)->get(); $cat_products_random_photos = []; foreach ($cat_random_product as $photo) { $cat_products_random_photos[] = $photo; } $category_data[] = ['color' => $cat_id['color'], 'floor' => $cat_id['floor'], 'name' => $cat_id['name'], 'desc' => $cat_id['description'], 'logo' => $cat_id['logo'], 'latest_photo_id' => $cat_latest_product_id, 'latest_photo' => $cat_latest_product, 'random_photos' => $cat_products_random_photos, 'brands' => $cat_brands]; } return view('landing_page', compact(['adSlot_data', 'category_data'])); }
public function getIndex($status = 'Pending') { $status = ucfirst($status); if ($status != 'Pending') { $query = Confession::orderBy('created_at', 'desc'); } else { $query = Confession::orderBy('created_at', 'asc'); } if (\Input::get('category')) { $query->whereHas('categories', function ($query) { $query->where('confession_categories.confession_category_id', '=', intval(\Input::get('category'))); }); } if (\Input::get('q')) { $search = stripslashes(\Input::get('q')); $query->where('content', 'LIKE', "%{$search}%"); } if (\Input::get('start') && \Input::get('end')) { $start = Carbon::createFromFormat('U', strtotime(\Input::get('start')))->startOfDay(); $end = Carbon::createFromFormat('U', strtotime(\Input::get('end')))->startOfDay(); if ($start > $end) { return \Redirect::back()->withMessage('Start date cannot be later than end date.')->with('alert-class', 'alert-danger'); } $query->where('created_at', '>=', $start->toDateTimeString()); $query->where('created_at', '<', $end->toDateTimeString()); } if ($status != 'All') { $query->where('status', '=', ucfirst($status)); } $confessions = $query->with('moderatorComments')->paginate(10); return view('admin.confessions.index', ['confessions' => $confessions, 'categoryOptions' => array_merge(array('All Categories' => 0), Category::orderBy('confession_category', 'asc')->lists('confession_category_id', 'confession_category')), 'hasPageToken' => (bool) $this->confessionsRepo->getPageToken()]); }
public function index() { $categories = Category::orderBy('name')->paginate(30); // if (Request::isMethod('get')) // { // $whereConditions = []; // if(!empty(Input::all())) // { // foreach (Input::all() as $key => $input) // { // if(!empty($input) && $key!='page' && $key!='_token') // $whereConditions[$key] = $input; // } // $fishs = Category::where($whereConditions)->paginate(30); // } // else // { // $fishs = Category::orderBy('name_ro')->paginate(30); // } // } // else // { // $fishs = Category::orderBy('name')->paginate(30); // } Request::flash(); return view('Admin.category.index')->with(['categories' => $categories])->withInput(Input::all()); }
private function get_categories() { $categories = Cache::rememberForever('wyshop_admin_category_categories', function () { $categories = Category::orderBy('parent_id', 'asc')->orderBy('sort_order', 'asc')->orderBy('id', 'asc')->get(); return tree($categories); }); return $categories; }
public function getMenuCategory($active = "") { $Model = new Category(); $Data = $Model->orderBy('id', 'DESC'); if (!empty($active)) { $Data = $Data->where('active', $active); } return $Data->get()->toArray(); }
public static function categoryList($category_type = null) { $categories = Category::orderBy('name', 'asc')->whereNull('deleted_at')->orderBy('name', 'asc'); if (!empty($category_type)) { $categories = $categories->where('category_type', '=', $category_type); } $category_list = array('' => trans('general.select_category')) + $categories->pluck('name', 'id')->toArray(); return $category_list; }
public function run() { $faker = Faker\Factory::create(); DB::table('advertisement')->delete(); foreach (range(1, 30) as $index) { $category_id = Category::orderBy(DB::raw('RAND()'))->first()->id; $city_id = Cities::orderBy(DB::raw('RAND()'))->first()->id; $type_id = AdType::orderBy(DB::raw('RAND()'))->first()->id; // $a_hash = AdsAttachment::orderBy(DB::raw('RAND()'))->first()->hash; Advertisement::create(['category_id' => $category_id, 'text' => $faker->paragraph(4), 'user_id' => 1, 'city_id' => $city_id, 'type_id' => $type_id, 'price' => 12345, 'approved' => rand(0, 1)]); } }
public function detail($id) { $page = 'catalog'; $title = Menu::where('key', $page)->value('name'); $menuHtml = $this->menuHtml($page); $menuItems = Menu::all(); $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render(); $pageInfo = Page::where('key', $page)->first(); $categories = Category::orderBy('sort', 'asc')->get(); $product = Product::with(['category', 'color'])->find($id); $product->increment('views'); $recommended = Product::with('category')->take(4)->get(); $smallCart = $this->smallCart(); $cartItem = $this->cartItem($product->id); $page = $product; $page->title = $product->name; return view('site.product', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'title' => $title, 'page' => $page, 'product' => $product, 'categories' => $categories, 'recommended' => $recommended, 'count' => $smallCart['count'], 'sum' => $smallCart['sum'], 'currentItem' => $cartItem, 'currentProductCategory' => $product->category]); }
public function index($page = '') { // $title = Menu::where('key', $page)->value('name'); $categories = Category::orderBy('sort', 'asc')->get(); $menuHtml = $this->menuHtml($page); if (session()->has('cart')) { $cartItems = session()->get('cart'); $sum = $cartItems->sum(); $count = count($cartItems->all()); } else { $sum = 0; $count = 0; } $menuItems = Menu::all(); $products = Product::with('category')->orderBy('views', 'desc')->take(8)->get(); $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render(); $page = Page::where('key', 'index')->first(); return view('index', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'categories' => $categories, 'count' => $count, 'sum' => $sum, 'products' => $products, 'indexFlag' => true, 'page' => $page]); }
/** * Bootstrap any application services. * * @return void */ public function boot() { \View::composer('frontend.partials.sidebar', function ($view) { /** @var \Illuminate\View\View $view */ Menu::make('sidebar', function ($menu) { /** @var \Lavary\Menu\Builder $menu */ /** @var \Illuminate\Database\Eloquent\Collection $tree */ $tree = Category::orderBy('name', 'asc')->published()->get()->toHierarchy(); $tree->each(function (Category $category) use($menu) { /** @var \Lavary\Menu\Item $item */ $item = $menu->add($category->name, ['route' => ['category.show', $category->slug]]); if ($category->children->count() !== 0) { $category->children->each(function (Category $category) use($item) { $item->add($category->name, ['route' => ['category.show', $category->slug]]); }); } }); }); }); }
public function search(Request $request) { $page = new \stdClass(); $page->title = 'Поиск'; $page->keywords = 'Поиск'; $page->description = 'Поиск'; $page->key = 'search'; $menuHtml = $this->menuHtml('cart'); $menuItems = Menu::all(); $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render(); $categories = Category::orderBy('sort', 'asc')->get(); $smallCart = $this->smallCart(); if ($request->has('val')) { $products = Product::where('name', 'like', "%{$request->val}%")->orWhere('text', 'like', "%{$request->val}%")->get(); $val = $request->get('val'); } else { $val = ''; $products = []; } return view('site.search', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'page' => $page, 'categories' => $categories, 'products' => $products, 'count' => $smallCart['count'], 'sum' => $smallCart['sum'], 'indexFlag' => true, 'search' => $val]); }
public function index(Request $request) { $page = new \stdClass(); $page->title = 'Корзина'; $page->keywords = 'Корзина'; $page->description = 'Корзина'; $page->key = 'cart'; // $title = Menu::where('key', 'cart')->value('name'); $menuHtml = $this->menuHtml('cart'); $menuItems = Menu::all(); $bottomMenuHtml = view('bottom', ['menuItems' => $menuItems])->render(); // $page = Page::where('key', $page)->first(); $cart = $request->session()->get('cart'); if ($cart) { $items = $cart->all(); } else { $items = false; } $categories = Category::orderBy('sort', 'asc')->get(); $smallCart = $this->smallCart(); return view('site.cart', ['menuHtml' => $menuHtml, 'menuBottomHtml' => $bottomMenuHtml, 'page' => $page, 'items' => $items, 'categories' => $categories, 'count' => $smallCart['count'], 'sum' => $smallCart['sum'], 'deliverySum' => $smallCart['deliverySum'], 'totalSum' => $smallCart['deliverySum'] + $smallCart['sum']]); }
function list_search_condition() { $user_searches = User_search::where('user_id', $this->user->id)->get(); foreach ($user_searches as &$user_search) { if ($user_search->shokushu_id) { $user_search['user_shokushus'] = unserialize($user_search->shokushu_id); } if ($user_search->kinmuchi_id) { $user_search['user_kinmuchis'] = unserialize($user_search->kinmuchi_id); } if ($user_search->keitai_id) { $user_search['user_keitais'] = unserialize($user_search->keitai_id); } if ($user_search->category_id) { $user_search['user_categories'] = unserialize($user_search->category_id); } } $shokushus = Shokushu::get(); $kinmuchis = Kinmuchi::get(); $keitais = Keitai::orderBy('sort_order', 'asc')->get(); $categories = Category::orderBy('sort_order', 'asc')->get(); // return $user_searches; return view('my.list_search_condition', ['user_searches' => $user_searches, 'shokushus' => $shokushus, 'kinmuchis' => $kinmuchis, 'keitais' => $keitais, 'categories' => $categories]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $categories = Category::orderBy('id', 'ASC')->paginate(15); return view('admin/categories/index')->with('categories', $categories); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $categories = Category::orderBy('is_active', 'asc')->orderBy('created_at', 'desc')->paginate($this->itemPerPage); return view('redac.categories.index', compact('categories')); }
/** * add function. * * @description Agrega cupones a la base de datos * @access public * @return void */ public function getAdd() { $categories = Category::orderBy('name', 'asc')->lists('name', 'id'); return View::make('admin.coupons.add')->with("categories", $categories); }
public function showEditCategory($id) { $category = Category::where('id', $id)->first(); $categories = Category::orderBy('name', 'asc')->get(); return view('admin.categoryedit')->with(['category' => $category, 'categories' => $categories]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $items = Category::orderBy('sort', 'asc')->get(); $data = ['route' => 'categories', 'title' => Category::$tableName, 'items' => $items]; return view("admin.categories.list", $data); }
/** * Get all Categories. * * @return mixed */ public function all() { return $this->model->orderBy('hot', 'desc')->get(); }
protected function onGet(\Illuminate\Http\Request $input) { $this->data['categories'] = Category::orderBy('name')->paginate(25, ['*'], 'subpage'); return parent::onGet($input); }
/** * Display a listing of the resource. * * @return Response */ public function admin() { $categories = Category::orderBy('created_at', 'DESC')->get(); return view('categories.backend.index', compact('categories')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $item = Product::with(['color', 'category'])->find($id); $images = $item->images; $categories = Category::orderBy('sort', 'asc')->get(); $formCategories = []; foreach ($categories as $category) { $formCategories[$category->id] = $category->name; } $colors = Color::all(); $formColors = []; foreach ($colors as $color) { $formColors[$color->id] = $color->name; } $data = ['title' => Product::$tableName, 'item' => $item, 'images' => $images, 'categories' => $formCategories, 'colors' => $formColors]; return view("admin.{$this->key}.edit", $data); }
public function index() { $t = Category::orderBy('category')->orderBy('sort_order')->get()->toArray(); return response($t)->header('Access-Control-Allow-Origin', '*')->header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')->header('Access-Control-Allow-Headers', 'Origin, Content-Type, Accept, Authorization, X-Request-With')->header('Access-Control-Allow-Credentials', 'true'); }
/** * Display a listing of the resource. */ public function index() { $categories = Category::orderBy('id', 'desc')->paginate(5); return view('admin.categories.index', ['categories' => $categories]); }
public function index() { $categories = Category::orderBy("id", "asc"); $categories = $categories->paginate(Config('constants.paginateNo')); return view(Config('constants.adminCategoryView') . '.index', compact('categories')); }
public function categories() { $categories = Category::orderBy('id', 'desc')->get(); return view('admin.categories')->with('categories', $categories); }