src/Controllers/Install.php
public function installAction()
    {
        // Create database connection and load migrations
        $connection = ConnectionManager::create($_SESSION['db']);
        $this->loadMigrations();

        // Migrate the database.
        $m = new Migrator;
        $m->migrate('up');

        // Create admin account
        $admin = new User($_SESSION['admin'] + [
            'name'     => $_SESSION['admin']['username'],
            'group_id' => 1
        ]);
        $admin->save();

        // Set config file contents
        $this->set("config", $this->makeConfig());

        // Insert defaults
        $seeder = new Seeder;
        $seeder->seed();

        // Remove database and account details from the session.
        unset($_SESSION['db'], $_SESSION['admin']);

        $this->title("Complete");
        return $this->render("complete.phtml");
    }
public function installAction()
    {
        // Create database connection and load migrations
        $connection = ConnectionManager::create($_SESSION['db']);
        $this->loadMigrations();

        // Migrate the database.
        $m = new Migrator;
        $m->migrate('up');

        // Create admin account
        $admin = new User($_SESSION['admin'] + [
            'name'     => $_SESSION['admin']['username'],
            'group_id' => 1
        ]);
        $admin->save();

        // Set config file contents
        $this->set("config", $this->makeConfig());

        // Insert defaults
        $seeder = new Seeder;
        $seeder->seed();

        // Remove database and account details from the session.
        unset($_SESSION['db'], $_SESSION['admin']);

        $this->title("Complete");
        return $this->render("complete.phtml");
    }
public function installAction ( ) { // Create database connection and load migrations $ connection = ConnectionManager :: create ( $ _SESSION [ 'db' ] ) ; $ this -> loadMigrations ( ) ; // Migrate the database. $ m = new Migrator ; $ m -> migrate ( 'up' ) ; // Create admin account $ admin = new User ( $ _SESSION [ 'admin' ] + [ 'name' => $ _SESSION [ 'admin' ] [ 'username' ] , 'group_id' => 1 ] ) ; $ admin -> save ( ) ; // Set config file contents $ this -> set ( "config" , $ this -> makeConfig ( ) ) ; // Insert defaults $ seeder = new Seeder ; $ seeder -> seed ( ) ; // Remove database and account details from the session. unset ( $ _SESSION [ 'db' ] , $ _SESSION [ 'admin' ] ) ; $ this -> title ( "Complete" ) ; return $ this -> render ( "complete.phtml" ) ; }
Migrate database and create admin account.
Migrate database and create admin account .