public static function getMenu() { $categoryCls = new CategoryModel(); $arrParentList = $categoryCls->getParentList(); $arrChirdList = $categoryCls->getChildList(); return view('Frontend.menu', ['arrParentList' => $arrParentList, 'arrChirdList' => $arrChirdList]); }
public static function getIndex() { $categoryCls = new CategoryModel(); $productCls = new ProductModel(); $customersModel = new CustomersModel(); // check if user login later register if (Session::has('register_flag')) { $data = $customersModel->getUserByEmail(Session::get('customer_email')); Mail::send('Frontend.email.register', $data, function ($message) use($data) { $message->to($data['customer_email'], $data['customer_name'])->subject('Cường thuỷ - Xác nhận đăng kí!'); }); Session::forget('register_flag'); } $arrParentList = $categoryCls->getParentList(); $arrChirdList = $categoryCls->getChildList(); foreach ($arrParentList as $key => $val) { $whereArr = array('OR' => array('categories.id' => $key, 'categories.category_parent' => $key)); $joinsArr = array(array('table' => 'categories', 'type' => 'INNER', 'conditions' => 'products.product_category = categories.id')); $limitArr = array(self::$PRODUCT_MAX); $arrProductList[$key] = $productCls->getProductList($whereArr, $limitArr, $joinsArr); } $arrProductNew = $productCls->getProductNew(array(), array(self::$PRODUCT_MAX)); BaseController::$title = 'Uy tín, chất lượng, giá rẻ cho mọi nhà '; return view('Frontend.index', ['arrParentList' => $arrParentList, 'arrChirdList' => $arrChirdList, 'arrProductList' => $arrProductList, 'arrProductNew' => $arrProductNew]); }