public function indexAction($seo = null) { $portfolio = new \modules\portfolio\models\Portfolio(); $categories = new \modules\portfolio\models\Portfolio_categories(); if ($seo) { $categories->seo = $seo; $categories->_select = 'blog_category_id, title'; $cat = $categories->get(); if (!$cat) { return Brightery::error404(); } $portfolio->portfolio_category_id = $cat->portfolio_category_id; } $categories->_select = 'seo, title, portfolio_category_id'; $categories->seo = FALSE; return $this->render('index', ['portfolio' => $portfolio->get(), 'categories' => $categories->get()]); }
public function manageAction($id = false) { $this->permission('manage'); $model = new \modules\portfolio\models\Portfolio_categories(); $model->attributes = $this->Input->post(); $model->language_id = $this->language->getDefaultLanguage(); if (!$id) { $model->created = date("Y-m-d H:i:s"); } if ($id) { $model->portfolio_category_id = $id; } if ($model->save()) { Uri_helper::redirect("management/portfolio_categories"); } return $this->render('portfolio_categories/manage', ['item' => $id ? $model->get() : null]); }