app\modules\data\commands\SetupController::actionIndex PHP Method

actionIndex() public method

public actionIndex ( )
    public function actionIndex()
    {
        $lang = new Lang();
        $lang->scenario = 'restcreate';
        $lang->attributes = ['name' => 'Deutsch', 'short_code' => 'de', 'is_default' => 0];
        $lang->save(false);
        foreach ($this->pages as $d) {
            $model = new Nav();
            $navItemId = $model->createPage($d['parent'], 1, 1, $d['title'], $d['alias'], 1, 'Description of ' . $d['title']);
            if ($navItemId) {
                $item = NavItem::findOne(['alias' => $d['alias']]);
                if ($item) {
                    $item->nav->updateAttributes(['is_offline' => 0, 'is_hidden' => 0]);
                }
            }
        }
        foreach ($this->redirects as $redir) {
            $model = new Nav();
            $redirItemId = $model->createRedirect($redir['parent'], 1, 1, $redir['title'], $redir['alias'], $redir['type'], $redir['typeValue'], 'Description of ' . $redir['title']);
            if ($redirItemId) {
                $item = NavItem::findOne(['alias' => $redir['alias']]);
                if ($item) {
                    $item->nav->updateAttributes(['is_offline' => 0, 'is_hidden' => 0]);
                }
            }
        }
    }
SetupController