Completed
Push — master ( 782d2b...c13a9b )
by
unknown
51:48 queued 23:53
created
data/phinx/migrations/20161229132336_article_videos.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
 {
11 11
     public function up()
12 12
     {
13
-        $this->table('article_videos', ['id' => false])
14
-            ->addColumn('article_uuid', 'binary', ['limit' => 16])
13
+        $this->table('article_videos', [ 'id' => false ])
14
+            ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ])
15 15
             ->addColumn('title', 'text')
16
-            ->addColumn('sub_title', 'text', ['null' => true])
16
+            ->addColumn('sub_title', 'text', [ 'null' => true ])
17 17
             ->addColumn('body', 'text')
18 18
             ->addColumn('lead', 'text')
19 19
             ->addColumn('video_url', 'text')
20
-            ->addColumn('featured_img', 'text', ['null' => true])
21
-            ->addColumn('main_img', 'text', ['null' => true])
22
-            ->addForeignKey('article_uuid', 'articles', 'article_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])
20
+            ->addColumn('featured_img', 'text', [ 'null' => true ])
21
+            ->addColumn('main_img', 'text', [ 'null' => true ])
22
+            ->addForeignKey('article_uuid', 'articles', 'article_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ])
23 23
             ->create();
24 24
 
25 25
 //        $this->insertDummyData();
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 
33 33
     private function insertDummyData()
34 34
     {
35
-        $ids  = [];
35
+        $ids  = [ ];
36 36
         $rows = $this->fetchAll('select admin_user_uuid from admin_users;');
37
-        foreach($rows as $r) {
38
-            $ids[] = $r['admin_user_uuid'];
37
+        foreach ($rows as $r) {
38
+            $ids[ ] = $r[ 'admin_user_uuid' ];
39 39
         }
40 40
 
41 41
         $faker      = Faker\Factory::create();
@@ -48,19 +48,19 @@  discard block
 block discarded – undo
48 48
         ];
49 49
 
50 50
         // Download N images and set it randomly to posts
51
-        for($i = 0; $i < 5; $i++) {
51
+        for ($i = 0; $i < 5; $i++) {
52 52
             $image       = $faker->image();
53 53
             $destination = $upload->getPath(basename($image));
54 54
             rename($image, $destination);
55
-            $mainImg[] = substr($destination, strlen('/var/www/unfinished/public'));
55
+            $mainImg[ ] = substr($destination, strlen('/var/www/unfinished/public'));
56 56
 
57 57
             $image       = $faker->image();
58 58
             $destination = $upload->getPath(basename($image));
59 59
             rename($image, $destination);
60
-            $featuredImg[] = substr($destination, strlen('/var/www/unfinished/public'));
60
+            $featuredImg[ ] = substr($destination, strlen('/var/www/unfinished/public'));
61 61
         }
62 62
 
63
-        for($i = 0; $i < $count; $i++) {
63
+        for ($i = 0; $i < $count; $i++) {
64 64
             $id        = $faker->uuid;
65 65
             $mysqluuid = (new Uuid($id))->toFormat(new Binary());
66 66
             $title     = $faker->sentence(7, 20);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                 'article_id'      => $id,
71 71
                 'slug'            => strtolower(trim(preg_replace('~[^\pL\d]+~u', '-', $title), '-')),
72 72
                 'status'          => 1,
73
-                'admin_user_uuid' => $ids[array_rand($ids)],
73
+                'admin_user_uuid' => $ids[ array_rand($ids) ],
74 74
                 'type'            => ArticleType::POST
75 75
             ];
76 76
 
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
                 'title'        => $title,
80 80
                 'body'         => $faker->paragraph(15),
81 81
                 'lead'         => $faker->paragraph(5),
82
-                'main_img'     => $mainImg[array_rand($mainImg)],
83
-                'featured_img' => $featuredImg[array_rand($featuredImg)],
84
-                'video_url'    => $embedCodes[rand(0, 2)]
82
+                'main_img'     => $mainImg[ array_rand($mainImg) ],
83
+                'featured_img' => $featuredImg[ array_rand($featuredImg) ],
84
+                'video_url'    => $embedCodes[ rand(0, 2) ]
85 85
             ];
86 86
 
87 87
             $this->insert('articles', $article);
Please login to merge, or discard this patch.
data/phinx/migrations/20170523131220_newsletter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
     public function change()
9 9
     {
10
-        $this->table('newsletter', ['id' => false])
10
+        $this->table('newsletter', [ 'id' => false ])
11 11
             ->addColumn('email', 'text')
12
-            ->addColumn('created_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP'])
12
+            ->addColumn('created_at', 'timestamp', [ 'default' => 'CURRENT_TIMESTAMP' ])
13 13
             ->create();
14 14
     }
15 15
 }
Please login to merge, or discard this patch.
data/phinx/seeds/ArticleEvents.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
         $allUsers    = array_column($articleEvents->getAdapter()->fetchAll('select admin_user_uuid from admin_users'), 'admin_user_uuid');
19 19
         $allCategory = array_column($articleEvents->getAdapter()->fetchAll('select category_uuid from category'), 'category_uuid');
20 20
 
21
-        for($i = 0; $i < $count; $i++) {
21
+        for ($i = 0; $i < $count; $i++) {
22 22
             // Insert Article
23 23
             $id           = $faker->uuid;
24 24
             $mysqlUuid    = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary());
25 25
             $title        = $faker->sentence();
26
-            $userUuid     = $allUsers[rand(0, (count($allUsers) - 1))];
27
-            $categoryUuid = $allCategory[rand(0, (count($allCategory) - 1))];
26
+            $userUuid     = $allUsers[ rand(0, (count($allUsers) - 1)) ];
27
+            $categoryUuid = $allCategory[ rand(0, (count($allCategory) - 1)) ];
28 28
             $data         = [
29 29
                 'article_uuid'      => $mysqlUuid,
30 30
                 'article_id'        => $id,
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
                 'start_at'     => $faker->dateTimeBetween('now', '+5 days')->format('Y-m-d H:i:s'),
53 53
                 'end_at'       => $faker->dateTimeBetween('+5 days', '+6 days')->format('Y-m-d H:i:s'),
54 54
                 'event_url'    => 'https://www.meetup.com/Tokyo-Hello-Kitty-Meetup/',
55
-                'featured_img' => $featuredImages[rand(0, (count($featuredImages) - 1))],
56
-                'main_img'     => $mainImages[rand(0, (count($mainImages) - 1))]
55
+                'featured_img' => $featuredImages[ rand(0, (count($featuredImages) - 1)) ],
56
+                'main_img'     => $mainImages[ rand(0, (count($mainImages) - 1)) ]
57 57
             ];
58 58
 
59 59
             $articleEvents->insert($data)->save();
Please login to merge, or discard this patch.
data/phinx/seeds/Menu.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             'is_in_side'    => false,
41 41
             'order_no'      => 2,
42 42
             'article_uuid'  => null,
43
-            'category_uuid' => $categoryVideo['category_uuid']
43
+            'category_uuid' => $categoryVideo[ 'category_uuid' ]
44 44
         ])->save();
45 45
 
46 46
         // Insert events category in Menu
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             'is_in_side'    => false,
58 58
             'order_no'      => 3,
59 59
             'article_uuid'  => null,
60
-            'category_uuid' => $categoryVideo['category_uuid']
60
+            'category_uuid' => $categoryVideo[ 'category_uuid' ]
61 61
         ])->save();
62 62
 
63 63
         // Insert link to external web site
Please login to merge, or discard this patch.
data/phinx/seeds/AdminUsers.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function getImages($faker, $type = 'people', $width = 400, $height = 400)
13 13
     {
14
-        $images = [];
14
+        $images = [ ];
15 15
         $conf   = include __DIR__ . "/../../../config/autoload/local.php";
16
-        $p      = $conf['upload']['public_path'];
16
+        $p      = $conf[ 'upload' ][ 'public_path' ];
17 17
         $upload = new Upload($p, '');
18 18
 
19
-        for($i = 0; $i < 5; $i++) {
19
+        for ($i = 0; $i < 5; $i++) {
20 20
             $filename = md5(rand()) . '.jpg';
21
-            $path     = $p . $filename[0] . '/' . $filename[1] . '/' . $filename[2] . '/' . $filename;
21
+            $path     = $p . $filename[ 0 ] . '/' . $filename[ 1 ] . '/' . $filename[ 2 ] . '/' . $filename;
22 22
             $upload->getPath($filename); // create sub folders
23 23
             $img = file_get_contents($faker->imageUrl(400, 400, $type));
24 24
             file_put_contents($path, $img);
25 25
 
26
-            $images[] = $upload->getWebPath($filename);
26
+            $images[ ] = $upload->getWebPath($filename);
27 27
         }
28 28
 
29 29
         return $images;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $faceImages    = $this->getImages($faker, 'people');
38 38
         $profileImages = $this->getImages($faker, 'fashion');
39 39
 
40
-        for($i = 0; $i < $count; $i++) {
40
+        for ($i = 0; $i < $count; $i++) {
41 41
             $id        = $faker->uuid;
42 42
             $mysqluuid = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary());
43 43
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
                 'status'          => rand(0, 1),
52 52
                 'last_login'      => rand(0, 10) === 7 ? null : $faker->dateTimeBetween('-10 days', 'now')->format('Y-m-d H:i:s'),
53 53
                 'created_at'      => $faker->dateTimeBetween('-20 days', '-10 days')->format('Y-m-d H:i:s'),
54
-                'face_img'        => $faceImages[rand(0, (count($faceImages) - 1))],
55
-                'profile_img'     => $profileImages[rand(0, (count($profileImages) - 1))]
54
+                'face_img'        => $faceImages[ rand(0, (count($faceImages) - 1)) ],
55
+                'profile_img'     => $profileImages[ rand(0, (count($profileImages) - 1)) ]
56 56
             ];
57 57
 
58 58
             $users->insert($data)->save();
Please login to merge, or discard this patch.
data/phinx/seeds/ACategory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
         $category = $this->table('category');
12 12
         $count    = rand(5, 10);
13 13
 
14
-        for($i = 0; $i < $count; $i++) {
14
+        for ($i = 0; $i < $count; $i++) {
15 15
             $id           = $faker->uuid;
16 16
             $mysqlUuid    = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary());
17 17
             $categoryName = $faker->name;
Please login to merge, or discard this patch.
data/phinx/seeds/ArticleVideos.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
         $allUsers    = array_column($articleVideos->getAdapter()->fetchAll('select admin_user_uuid from admin_users'), 'admin_user_uuid');
27 27
         $allCategory = array_column($articleVideos->getAdapter()->fetchAll('select category_uuid from category'), 'category_uuid');
28 28
 
29
-        for($i = 0; $i < $count; $i++) {
29
+        for ($i = 0; $i < $count; $i++) {
30 30
             // Insert Article
31 31
             $id           = $faker->uuid;
32 32
             $mysqlUuid    = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary());
33 33
             $title        = $faker->sentence();
34
-            $userUuid     = $allUsers[rand(0, (count($allUsers) - 1))];
35
-            $categoryUuid = $allCategory[rand(0, (count($allCategory) - 1))];
34
+            $userUuid     = $allUsers[ rand(0, (count($allUsers) - 1)) ];
35
+            $categoryUuid = $allCategory[ rand(0, (count($allCategory) - 1)) ];
36 36
             $data         = [
37 37
                 'article_uuid'      => $mysqlUuid,
38 38
                 'article_id'        => $id,
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
                 'sub_title'    => $faker->sentence(),
57 57
                 'body'         => $faker->paragraph(30),
58 58
                 'lead'         => $faker->paragraph(5),
59
-                'video_url'    => self::VIDEOS[rand(0, (count(self::VIDEOS) - 1))],
60
-                'featured_img' => $featuredImages[rand(0, (count($featuredImages) - 1))],
61
-                'main_img'     => $mainImages[rand(0, (count($mainImages) - 1))]
59
+                'video_url'    => self::VIDEOS[ rand(0, (count(self::VIDEOS) - 1)) ],
60
+                'featured_img' => $featuredImages[ rand(0, (count($featuredImages) - 1)) ],
61
+                'main_img'     => $mainImages[ rand(0, (count($mainImages) - 1)) ]
62 62
             ];
63 63
 
64 64
             $articleVideos->insert($data)->save();
Please login to merge, or discard this patch.
data/phinx/migrations/20160908142829_admin_users.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@  discard block
 block discarded – undo
8 8
 {
9 9
     public function up()
10 10
     {
11
-        $this->table('admin_users', ['id' => false, 'primary_key' => 'admin_user_uuid'])
12
-            ->addColumn('admin_user_uuid', 'binary', ['limit' => 16])
11
+        $this->table('admin_users', [ 'id' => false, 'primary_key' => 'admin_user_uuid' ])
12
+            ->addColumn('admin_user_uuid', 'binary', [ 'limit' => 16 ])
13 13
             ->addColumn('admin_user_id', 'text')
14 14
             ->addColumn('first_name', 'text')
15 15
             ->addColumn('last_name', 'text')
16
-            ->addColumn('introduction', 'text', ['null' => true])
17
-            ->addColumn('biography', 'text', ['null' => true])
18
-            ->addColumn('email', 'string', ['limit' => 128])
19
-            ->addColumn('password', 'char', ['limit' => 60])
20
-            ->addColumn('status', 'integer', ['default' => 0])// 0 => not active, 1 = active
21
-            ->addColumn('face_img', 'text', ['null' => true])
22
-            ->addColumn('profile_img', 'text', ['null' => true])
23
-            ->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
24
-            ->addColumn('last_login', 'datetime', ['null' => true])
25
-            ->addIndex(['email'], ['name' => 'email_INDEX'])
16
+            ->addColumn('introduction', 'text', [ 'null' => true ])
17
+            ->addColumn('biography', 'text', [ 'null' => true ])
18
+            ->addColumn('email', 'string', [ 'limit' => 128 ])
19
+            ->addColumn('password', 'char', [ 'limit' => 60 ])
20
+            ->addColumn('status', 'integer', [ 'default' => 0 ])// 0 => not active, 1 = active
21
+            ->addColumn('face_img', 'text', [ 'null' => true ])
22
+            ->addColumn('profile_img', 'text', [ 'null' => true ])
23
+            ->addColumn('created_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ])
24
+            ->addColumn('last_login', 'datetime', [ 'null' => true ])
25
+            ->addIndex([ 'email' ], [ 'name' => 'email_INDEX' ])
26 26
             ->create();
27 27
 
28 28
         // Insert one default admin user with password testtest
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
     private function getImage($faker, $type = 'people', $width = 400, $height = 400)
52 52
     {
53 53
         $conf     = include __DIR__ . "/../../../config/autoload/local.php";
54
-        $p        = $conf['upload']['public_path'];
54
+        $p        = $conf[ 'upload' ][ 'public_path' ];
55 55
         $upload   = new \UploadHelper\Upload($p, '');
56 56
         $filename = md5(rand()) . '.jpg';
57
-        $path     = $p . $filename[0] . '/' . $filename[1] . '/' . $filename[2] . '/' . $filename;
57
+        $path     = $p . $filename[ 0 ] . '/' . $filename[ 1 ] . '/' . $filename[ 2 ] . '/' . $filename;
58 58
         $upload->getPath($filename); // create sub folders
59 59
         $img = file_get_contents($faker->imageUrl(400, 400, $type));
60 60
         file_put_contents($path, $img);
Please login to merge, or discard this patch.
data/phinx/migrations/20170602123627_page.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@
 block discarded – undo
6 6
 {
7 7
     public function change()
8 8
     {
9
-        $this->table('page', ['id' => false])
10
-            ->addColumn('page_uuid', 'binary', ['limit' => 16])
9
+        $this->table('page', [ 'id' => false ])
10
+            ->addColumn('page_uuid', 'binary', [ 'limit' => 16 ])
11 11
             ->addColumn('page_id', 'text')
12 12
             ->addColumn('title', 'text')
13 13
             ->addColumn('body', 'text')
14 14
             ->addColumn('description', 'text')
15 15
             ->addColumn('slug', 'text')
16
-            ->addColumn('main_img', 'text', ['null' => true])
17
-            ->addColumn('has_layout', 'boolean', ['default' => true])
18
-            ->addColumn('is_homepage', 'boolean', ['default' => false])
19
-            ->addColumn('is_active', 'boolean', ['default' => false])
20
-            ->addColumn('is_wysiwyg_editor', 'boolean', ['default' => false])
21
-            ->addColumn('created_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP'])
16
+            ->addColumn('main_img', 'text', [ 'null' => true ])
17
+            ->addColumn('has_layout', 'boolean', [ 'default' => true ])
18
+            ->addColumn('is_homepage', 'boolean', [ 'default' => false ])
19
+            ->addColumn('is_active', 'boolean', [ 'default' => false ])
20
+            ->addColumn('is_wysiwyg_editor', 'boolean', [ 'default' => false ])
21
+            ->addColumn('created_at', 'timestamp', [ 'default' => 'CURRENT_TIMESTAMP' ])
22 22
             ->create();
23 23
     }
24 24
 }
Please login to merge, or discard this patch.