public function index() { $topic = new Topic(); $topics = Topic::all(); //echo "<pre>"; //$ss = $topic->GetUserinfo(); //print_r($ss); //echo $topic::find(1)->user->username; $product = \Product::Find(['slug' => 'decorative-hedgehogs']); print_r($product); return view("index")->with('topic', $topics); }
public function categoryShow($categorySlug) { dd($categorySlug); try { // Get category $category = \Category::Find(['slug' => $categorySlug, 'status' => 1]); if ($category['result'][0]) { // Get products $products = \Product::Find(['limit' => $this->app->config['app_per_page'], 'offset' => $offset, 'category' => $category['result'][0]['id']]); // Assign products $category['products'] = $products['result']; } else { $this->app->redirect('404'); } } catch (\Exception $e) { exit($e->getMessage()); } // Build page $this->render('Views/Category', $category); }