/** * Creates a new BillableItem model. * If creation is successful, the browser will be redirected to the 'index' page. * * @return mixed */ public function actionCreate() { /** @var BillableItem $billable */ $billable = Yii::createObject(['class' => BillableItem::className()]); $this->performAjaxValidation($billable); if ($billable->load(Yii::$app->request->post()) && $billable->save()) { Yii::$app->getSession()->setFlash('success', Yii::t('account-billing', 'BillableItem has been created')); return $this->redirect(['update', 'id' => Uuid::uuid2str($billable->id)]); } return $this->render('create', ['model' => $billable]); }
/** * @return \yii\db\ActiveQuery */ public function getItems() { return $this->hasMany(BillableItem::className(), ['id' => 'billing_item_id'])->viaTable('billing_payment_item', ['payment_id' => 'id']); }