public function actionCreate()
 {
     $model = new Pool();
     $pooltype = PoolType::find()->all();
     if ($model->load(Yii::$app->request->post())) {
         $model->capital_size = str_replace(',', "", $_POST['Pool']['capital_size']);
         $model->save();
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['type' => "create", 'model' => $model, 'pooltype' => $pooltype]);
     }
 }
Exemple #2
0
  <div class="row">
    <!-- Start Panel -->
    <div class="col-md-12">
      <div class="panel">
        <div class="panel-title">
          Pool
        <a class="btn btn-default pull-right" style="position:relative;" href="<?php 
echo Url::to(['/pool/create']);
?>
"><i class="fa fa-plus"></i>Create</a>
        </div>
        <div class="panel-body table-responsive">

		    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-bordered table-striped'], 'columns' => ['pool_id', 'name', ['attribute' => 'id_pool_type', 'value' => function ($model) {
    return PoolType::find()->where(["id_pool_type" => $model->id_pool_type])->one()->name;
}], 'capital_size', ['class' => '\\backend\\widgets\\ActionColumn', 'template' => '{view}{update}{delete}{banks}', 'width' => '12%', 'detailViewAttributes' => ['id_pool_type', 'name', 'pool_id', 'capital_size', 'description'], 'buttons' => ['banks' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-list-alt"></span>', "index.php?id=" . $model->id_pool . "&r=bank-pool/index", ["target" => "_blank", 'class' => 'btn btn-light btn-icon']);
}]]]]);
?>
      	  </div>
      </div>
    <!-- End Panel -->
    </div>
  <!-- End Row -->
  </div>
<!-- END CONTAINER -->
</div>