First we will assume that the church website is built into a virtual localhost address http://wmck.local

Create the ''main'', the ''three boxes on top'', the ''ministries'' and the ''upcoming'' events migration files.
<code>
./yii migrate/create create_main_table
./yii migrate/create create_topbox_table
./yii migrate/create create_ministries_table
./yii migrate/create create_upcoming_table
</code>

In the ''main'' migration file, insert this under ''safeUp''
<code php>
            'id' => $this->primaryKey(),
            'abbr' => $this->string(10)->notNull(),
            'title' => $this->string(50)->notNull(),
            'bannertitle' => $this->string(50)->notNull(),
            'vision' => $this->string(120)->notNull(),
            'themetitle' => $this->string(30)->notNull(),
            'theme' => $this->string(50)->notNull(),
            'fpbanner' => $this->string(40)->notNull(),
            'email' => $this->string(40)->notNull(),
            'address' => $this->string(100)->notNull(),
            'phone' => $this->string(20)->notNull(),
            'layleader' => $this->string(50)->null(),
            'lcecchairman' => $this->string(50)->null(),
            'churchmap' => $this->string(40)->null(),
            'biggermap' => $this->string(40)->null(),
            'gmapscreen' => $this->string(40)->null(),
            'goostreetview' => $this->string(160)->null(),
            'gps' => $this->string(30)->null(),
            'calendar' => $this->string(200)->null(),
            'footer' => $this->string(200)->null(),
        ], 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB');

        $columns = ['abbr', 'title', 'bannertitle', 'vision', 'themetitle', 'theme', 'fpbanner', 'email', 'address', 'phone', 'layleader', 'lcecchairman', 'churchmap', 'biggermap', 'gmapscreen', 'goostreetview', 'gps', 'calendar', 'footer'];
        $this->batchInsert('main', $columns, [
        ['WMCK',
        'Wesley Methodist Church Kepong',
        'Wesley Methodist Church Kepong',
        'To prepare God&apos;s people for God&apos;s awakening; to experience and live in the Presence and Glory of God',
        'OUR THEME 2017',
        'Closer to God',
        '/uploads/fpbanner',
        'wesleykepong@gmail.com',
        'No.3, Jalan EIP 2, Ehsan Industrial Park, Kepong, 52100, Kuala Lumpur, Malaysia',
        '03-6262 3154',
        'Michael Chew',
        'Hua Kia Long',
        '/uploads/WMCKmap2013thumb.png',
        '/uploads/WMCKmap2013.jpg',
        '/uploads/WMCK_Google.jpg',
        'https://www.google.com.my/maps/@3.2150973,101.6210893,3a,75y,74.91h,79.5t/data=!3m6!1e1!3m4!1sCar4dyvXS7dOhX2pWNgkQQ!2e0!7i13312!8i6656!6m1!1e1?hl=en',
        '3.215556, 101.621956',
        'https://www.google.com/calendar/embed?height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=1ljl77234bvp0aafmhi3qs4agk%40group.calendar.google.com&amp;color=%23182C57&amp;ctz=Asia%2FKuala_Lumpur',
        '© WMCK 2012 &ndash; Layout based on <a href="http://www.yaml.de">YAML</a> | Go to <a href="albums/index.php">our Photo Album</a>'],
        ]);
</code>

Note that **''id''** will already be defined so don't copy that. This will insert some main initial info.

Similarly in the ''topbox'' migration file, add
<code php>
            'id' => $this->primaryKey(),
            'box1title' => $this->string(40)->null(),
            'box1content' => $this->text()->null(),
            'box2title' => $this->string(40)->null(),
            'box2content' => $this->text()->null(),
            'box3title' => $this->string(40)->null(),
            'box3content' => $this->text()->null(),
        ], 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB');

        $columns = ['box1title','box1content','box2title','box2content','box3title','box3content'];
        $this->batchInsert('topbox', $columns, [
            ['Need Prayer?',
            'Hand in your prayer request(s) to the Pastor/Office for inclusion in our community praying. Or drop the completed Prayer Request Form into the Prayer Box',
            'Corporate Prayer',
            'Everyone is encouraged to join the Corporate Prayer held every Saturday at 10.00am. Let us come together to pray for the church and those in need',
            'Photos<br />2 July 2017',
            '<a href="https://photos.app.goo.gl/qCQbVQiWjLQrSeZH3">30th Anniversary 2017</a><br /><a href="https://photos.app.goo.gl/zpjaMqR1mQgg9DC12">KL Boys Brigade Sunday 27 August 2017</a><br /><a href="https://goo.gl/photos/Qz2rukmoni4BwMWF7">Infant Baptism 2 July 2012</a><br /><a href="https://goo.gl/photos/yMevDn9cxPuYMPWW8">Girls Brigade 18 June 2017</a><br /><br /><a href="https://photos.app.goo.gl/EvxDIB1yK2j0GD6o2">Miscellaneous</a>'],
            ]);
</code>

In the 'ministries' table, we can use ''Schema'' so on top add
<code php>
use yii\db\Schema;
use yii\db\Migration;
</code>

<code php>
            'id' => Schema::TYPE_PK,
            'day' => Schema::TYPE_STRING . '(10) NOT NULL',
            'title' => Schema::TYPE_STRING . '(100) NOT NULL',
            'content' => Schema::TYPE_STRING . '(100) NULL',
            'starttime' => Schema::TYPE_TIME . ' NULL',
            'endtime' => Schema::TYPE_TIME . ' NULL',
        ], 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB');
        $columns = ['day','title','content','starttime','endtime'];
        $this->batchInsert('ministries', $columns, [
            ['SUNDAY','Chinese Ministry','','08:45:00',''],
            ['SUNDAY','Worship Service','Holy Communion ( 1st Sunday )','10:00:00',''],
            ['SUNDAY','Sunday School/Children Ministry','','10:00:00',''],
            ['WEDNESDAY','Seniors Fellowship','','10:30:00',''],
            ['THURSDAY','Homemakers Fellowship','','10:00:00',''],
            ['THURSDAY','9th KL Girls&apos; Brigade Meeting','(at Wesley Methodist School, KL International)<br />
Contact Captain Cordilia','15:30:00','17:00:00'],
            ['FRIDAY','<b>Care Group Meetings</b>','','',''],
            ['FRIDAY','- Damansara Damai','','20:30:00',''],
            ['FRIDAY','- Bandar Sri Damansara','','20:30:00',''],
            ['FRIDAY','- Bandar Utama','','20:30:00',''],
            ['FRIDAY','- Bukit Maluri','','20:30:00',''],
            ['FRIDAY','- Taman Ehsan','','20:30:00',''],
            ['SATURDAY','Corporate Prayer Meeting','','10:00:00',''],
            ['SATURDAY','LCEC Meeting - Bi-monthly','','11:00:00',''],
        ]);
</code>
We need to do the ''upcoming'' events table
<code php>
            'event' => $this->string(100)->notNull(),
        ], 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB');
        $columns = ['event'];
        $this->batchInsert('upcoming', $columns, [
            ['One-Day Outing to Tanjung Sepat on 21st July 2018'],
            ['Methodist Prayer Convention 2018, Kingwood Hotel, Sibu, Sarawak 31st August - 2nd September'],
            ]);
</code>

and something for the ''About Us'' page, then do the CRUD and About and Contact pages.... and make updating only accessible to the admin user.

Go to [[ step_2_-_create_the_models_for_the_church_info_database|Step 2]]

Back to [[yii|Yii Main Index]]