'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,
]);
}
}
$('.butEdit').on('click', function(){
$(this)
.parents('.dataBlock')
.addClass('edit');
});
$('.dataBlock').removeClass('edit');
$('.butEdit').on('click', function(){
$('.dataBlock').removeClass('edit');
$(this)
.parents('.dataBlock')
.addClass('edit');
});