'components' => [
...
'cache' => [
'class' => 'yii\caching\FileCache',
],
...
]
public $mycheck;
['mycheck','safe'],
<?= $form->field($model, 'mycheck')->checkbox(); ?>
public function beforeSave($insert)
{
if (parent::beforeSave($insert)) {
if($this->mycheck == null){
//логика если не выбран
}else{
//логика если выбран
}
return true;
} else {
return false;
}
}
public function actionCreate()
{
$model = new MyModel;
if ($model->load(Yii::$app->request->post())) {
if($model->mycheck == null){
//логика если не выбран
}else{
//логика если выбран
}
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php