public function rules()
{
return [
['field1','field2'],'filter','filter'=>'\yii\helpers\HtmlPurifier::process']
];
}
'authManager' => [
'class' => 'yii\rbac\DbManager',
'cacheKey' => 'rbac',
'cache' => 'cache',
'defaultRoles' => ['guest'],
],
$model->id_user = Yii::$app->user->identity->id;
public function actionCreate()
{
$model = new Post();
$model->id_user = Yii::$app->user->identity->id;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}