public function actionAdd(){
$model = new Post();
if($model->load(Yii::$app->request->post()) && $model->validate()){
$model->author = Yii::$app->user->getId();
$model->save();
return $this->redirect('blog/index');
}
return $this->render('add', ['model' => $model]);
}
Таблица USERS, поля:
- id
- name
- email
...
Таблица SUBSCRIBIONS, поля:
- id
- expriratio_at
- plan_id
- user_id
Таблица PLANS, поля:
- id
- name
- price
...