/** * Creates a new Advertising model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Advertising(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } else { return $this->render('create', ['model' => $model]); } }
public function actionBanner() { $model = new Advertising(); $model['title'] = 'Bio Media t4'; $model['advertiser_id'] = 1; $model['image'] = '/uploads/demo/ads/t4.png'; $model['url'] = '#'; $model['position'] = 'top_center'; $model['position_detail'] = json_encode(['controller' => 'site', 'action' => 'index', 'id' => null]); if ($model->save()) { echo 'Ok'; } }