public function getArticle($type, $id) { $model = \ServiceFaq::find($id); if ($model === null) { return \Redirect::back(); } else { $parent = \ServiceFaq::find($model->_parent); } // Views if (\helper::views_cookie('service_faq', $id)) { $model->views = $model->views + 1; $model->save(); } $model->date = substr($model->created_at, 0, 10); // decode label and tab $lblIds = json_decode($model->labels, true); $labels = array(); if (!empty($lblIds)) { $labels = \ServiceFaq::orderBy('id', 'asc')->find($lblIds, array('id', 'title')); } $tabs = json_decode($model->tabs); if (empty($tabs)) { $tabs = array(); } $view = sprintf('aesthetics.%s.view_article', $type); return \View::make('aesthetics.serviceFaq.view_article', array('model' => &$model, 'parent' => &$parent, 'images' => \ServiceFaqImage::where('sid', '=', $model->id)->orderBy('sort', 'asc')->get(), 'labels' => &$labels, 'tabs' => &$tabs, 'navs' => $this->getNavigation($type), 'type' => $type)); }