public function actionCatalogDetail() { $modelSocial = Social::findOne(1); $modelCategiry = Category::find()->limit(4)->asArray()->all(); $item_id = Yii::$app->request->get('item'); $itemsModel = Items::findOne($item_id); $cat = $itemsModel->cat_id; $photosModel = Photo::getPhotos($item_id, 5); return $this->render('catalog-detail', ['itemsModel' => $itemsModel, 'modelCategiry' => $modelCategiry, 'cat' => $cat, 'photosModel' => $photosModel, 'modelSocial' => $modelSocial]); }
/** * Finds the Social model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Social the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Social::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }