public function up() { $records = array(array('url' => '/survey/activeIndex', 'title' => 'Активные проекты', 'content' => '', 'deletable' => false), array('url' => '/survey/nonActiveIndex', 'title' => 'Завершённые проекты', 'content' => '', 'deletable' => false), array('url' => '/our-power', 'title' => 'Наши мощности', 'content' => '', 'deletable' => false), array('url' => '/excursion-by-offices', 'title' => 'Экскурсия по офисам', 'content' => '', 'deletable' => false), array('url' => '/special-offers', 'title' => 'Акции и спецпредложения', 'content' => '', 'deletable' => false), array('url' => '/fun-moments', 'title' => 'Забавные моменты нашей работы', 'content' => '', 'deletable' => false), array('url' => '/avtozvonok', 'title' => 'Avtozvonok.com', 'content' => '', 'deletable' => false), array('url' => '/low-budget-investigations', 'title' => 'Малобюджетные исследования', 'content' => '', 'deletable' => false)); foreach ($records as $record) { $page = new SimplePage(); $page->setAttributes($record); $page->save(); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new SimplePage(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['SimplePage'])) { $model->attributes = $_POST['SimplePage']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function safeUp() { $page = new SimplePage(); $page->setAttributes(array('url' => '/cabinet/login', 'title' => '', 'content' => '', 'deletable' => false)); $page->save(); }