protected function findModel($id) { if (($model = ContactsSubjects::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionContacts() { return $this->render('contact', ['page' => Contacts::find()->where(['id' => 1])->one(), 'subjects' => ContactsSubjects::find()->all()]); }