public function actionIndex() { $model = new BasicProfile(); if (BasicProfile::find()->count()) { $profile = BasicProfile::find()->one(); return $this->render('index', compact('model', 'profile')); } return $this->render('index', compact('model')); }
use yii\bootstrap\Modal; use yii\helpers\Url; use yii\helpers\ArrayHelper; $this->title = 'Basic Profile'; ?> <div class="row"> <div class="col-sm-12"> <h2>Basic Profile</h2> <hr> <section> <?php if (!BasicProfile::find()->count()) { ?> <?php echo Html::button('Create Profile', ['value' => Url::to('/create'), 'class' => 'btn btn-success', 'id' => 'modal-button-create']); ?> <?php } else { ?> <?php Pjax::begin(['id' => 'profile-content']); ?> <div> <p><b><?php echo $profile->getAttributeLabel('firts_name'); ?>