/** * Show the form for creating a new resource. * * @return Response */ public function create() { $obj = new category(); $listCategory = $obj->all()->toArray(); return view('backend.pages.category.addCategory', compact('listCategory')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // $cat_id = new category(); $category = $cat_id->all(); $color = Color::all(); $size = Size::all(); $product = Product::find($id); return view('backend.pages.product.edit2', array('category' => $category, 'product' => $product, 'color' => $color, 'size' => $size)); }
public function article() { $data = array('m_article' => 'highlight', 'category' => category::all()); return View('backend.article', $data); }
public function recommend_analyze() { $data = Input::all(); spl_autoload_register(function ($class_name) { $file_name = str_replace('\\', '/', $class_name); $file_name = str_replace('_', '/', $file_name); $file = dirname(__FILE__) . "/src/{$file_name}.php"; if (is_file($file)) { include $file; } }); $tokenizer = new Recommend(); $classifier = new Classifier($tokenizer); $train = Recommend::all(); // training file here foreach ($train as $key) { # code... $classifier->train($key['label'], $key['context']); } // $classifier->train('Hot', 'It is so hot'); // $classifier->train('Cold', 'it is very cold'); $groups = $classifier->classify($data['content']); $rec = classification::find($groups); $content = $data['content']; $nav = new category(); $menu_top = $nav->menu_top($nav->all()->toArray()); $pro = new Product(); $product = $pro->getRecommend($groups); return view('frontend.pages.result', array('groups' => $groups, 'content' => $content, 'menu_top' => $menu_top, 'rec' => $rec, 'product' => $product)); //return $groups; }