@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Article\Mapper; |
| 5 | 5 | |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | public function getPaginationSelect($isActive = null) |
| 35 | 35 | { |
| 36 | 36 | $select = $this->getSql()->select() |
| 37 | - ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['slug', 'published_at', 'status', 'article_id']) |
|
| 38 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id', 'first_name', 'last_name']) |
|
| 39 | - ->where(['articles.type' => ArticleType::VIDEO]) |
|
| 40 | - ->order(['articles.created_at' => 'desc']); |
|
| 37 | + ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'slug', 'published_at', 'status', 'article_id' ]) |
|
| 38 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id', 'first_name', 'last_name' ]) |
|
| 39 | + ->where([ 'articles.type' => ArticleType::VIDEO ]) |
|
| 40 | + ->order([ 'articles.created_at' => 'desc' ]); |
|
| 41 | 41 | |
| 42 | - if($isActive !== null) { |
|
| 43 | - $select->where(['articles.status' => (int)$isActive]); |
|
| 42 | + if ($isActive !== null) { |
|
| 43 | + $select->where([ 'articles.status' => (int) $isActive ]); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | return $select; |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | public function get($id) |
| 50 | 50 | { |
| 51 | 51 | $select = $this->getSql()->select() |
| 52 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title']) |
|
| 52 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title' ]) |
|
| 53 | 53 | ->join('articles', 'article_videos.article_uuid = articles.article_uuid') |
| 54 | 54 | ->join('category', 'category.category_uuid = articles.category_uuid', |
| 55 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left') |
|
| 56 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
| 57 | - ->where(['articles.article_id' => $id]); |
|
| 55 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left') |
|
| 56 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
| 57 | + ->where([ 'articles.article_id' => $id ]); |
|
| 58 | 58 | |
| 59 | 59 | return $this->selectWith($select)->current(); |
| 60 | 60 | } |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | public function getLatest($limit = 50) |
| 63 | 63 | { |
| 64 | 64 | $select = $this->getSql()->select() |
| 65 | - ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at']) |
|
| 66 | - ->where(['articles.status' => 1]) |
|
| 67 | - ->order(['published_at' => 'desc']) |
|
| 65 | + ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
| 66 | + ->where([ 'articles.status' => 1 ]) |
|
| 67 | + ->order([ 'published_at' => 'desc' ]) |
|
| 68 | 68 | ->limit($limit); |
| 69 | 69 | |
| 70 | 70 | return $this->selectWith($select); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $select = $this->getSql()->select() |
| 76 | 76 | ->join('articles', 'article_videos.article_uuid = articles.article_uuid') |
| 77 | - ->where(['articles.slug' => $slug]); |
|
| 77 | + ->where([ 'articles.slug' => $slug ]); |
|
| 78 | 78 | |
| 79 | 79 | return $this->selectWith($select)->current(); |
| 80 | 80 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Article\Mapper; |
| 6 | 6 | |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | public function getPaginationSelect($status = null) |
| 37 | 37 | { |
| 38 | 38 | $select = $this->getSql()->select() |
| 39 | - ->columns(['title', 'body', 'longitude', 'latitude']) |
|
| 39 | + ->columns([ 'title', 'body', 'longitude', 'latitude' ]) |
|
| 40 | 40 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
| 41 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id', 'first_name', 'last_name']) |
|
| 42 | - ->where(['articles.type' => ArticleType::EVENT]) |
|
| 43 | - ->order(['created_at' => 'desc']); |
|
| 41 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id', 'first_name', 'last_name' ]) |
|
| 42 | + ->where([ 'articles.type' => ArticleType::EVENT ]) |
|
| 43 | + ->order([ 'created_at' => 'desc' ]); |
|
| 44 | 44 | |
| 45 | - if($status) { |
|
| 46 | - $select->where(['articles.status' => (int)$status]); |
|
| 45 | + if ($status) { |
|
| 46 | + $select->where([ 'articles.status' => (int) $status ]); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $select; |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | $select = $this->getSql()->select() |
| 55 | 55 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
| 56 | 56 | ->join('category', 'category.category_uuid = articles.category_uuid', |
| 57 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left') |
|
| 58 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
| 59 | - ->where(['articles.article_id' => $id]); |
|
| 57 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left') |
|
| 58 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
| 59 | + ->where([ 'articles.article_id' => $id ]); |
|
| 60 | 60 | |
| 61 | 61 | return $this->selectWith($select)->current(); |
| 62 | 62 | } |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | $select = $this->getSql()->select() |
| 67 | 67 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
| 68 | 68 | ->join('category', 'category.category_uuid = articles.category_uuid', |
| 69 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left') |
|
| 70 | - ->where(['articles.slug' => $slug]); |
|
| 69 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left') |
|
| 70 | + ->where([ 'articles.slug' => $slug ]); |
|
| 71 | 71 | |
| 72 | 72 | return $this->selectWith($select)->current(); |
| 73 | 73 | } |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | public function getLatest($limit = 50) |
| 76 | 76 | { |
| 77 | 77 | $select = $this->getSql()->select() |
| 78 | - ->join('articles', 'article_events.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at']) |
|
| 79 | - ->where(['articles.status' => 1]) |
|
| 80 | - ->order(['published_at' => 'desc']) |
|
| 78 | + ->join('articles', 'article_events.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
| 79 | + ->where([ 'articles.status' => 1 ]) |
|
| 80 | + ->order([ 'published_at' => 'desc' ]) |
|
| 81 | 81 | ->limit($limit); |
| 82 | 82 | |
| 83 | 83 | return $this->selectWith($select); |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | public function getFuture() |
| 87 | 87 | { |
| 88 | 88 | $select = $this->getSql()->select() |
| 89 | - ->where(['articles.status' => 1]) |
|
| 90 | - ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at']) |
|
| 89 | + ->where([ 'articles.status' => 1 ]) |
|
| 90 | + ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
| 91 | 91 | ->order(new Expression('rand()')); |
| 92 | 92 | |
| 93 | 93 | $select->where->greaterThanOrEqualTo('end_at', date('Y-m-d H:i:s')); |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | public function getPastSelect() |
| 99 | 99 | { |
| 100 | 100 | $select = $this->getSql()->select() |
| 101 | - ->where(['articles.status' => 1]) |
|
| 102 | - ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at']) |
|
| 103 | - ->order(['start_at' => 'desc']); |
|
| 101 | + ->where([ 'articles.status' => 1 ]) |
|
| 102 | + ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
| 103 | + ->order([ 'start_at' => 'desc' ]); |
|
| 104 | 104 | |
| 105 | 105 | $select->where->lessThan('end_at', date('Y-m-d H:i:s')); |
| 106 | 106 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Article\Mapper; |
| 5 | 5 | |
@@ -34,22 +34,22 @@ discard block |
||
| 34 | 34 | public function getPaginationSelect() |
| 35 | 35 | { |
| 36 | 36 | return $this->getSql()->select() |
| 37 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'is_homepage']) |
|
| 37 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'is_homepage' ]) |
|
| 38 | 38 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
| 39 | - ->join('category', 'articles.category_uuid = category.category_uuid', ['category_name' => 'name'], 'left') |
|
| 40 | - ->where(['articles.type' => ArticleType::POST]) |
|
| 41 | - ->order(['created_at' => 'desc']); |
|
| 39 | + ->join('category', 'articles.category_uuid = category.category_uuid', [ 'category_name' => 'name' ], 'left') |
|
| 40 | + ->where([ 'articles.type' => ArticleType::POST ]) |
|
| 41 | + ->order([ 'created_at' => 'desc' ]); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function get($id) |
| 45 | 45 | { |
| 46 | 46 | $select = $this->getSql()->select() |
| 47 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage']) |
|
| 47 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage' ]) |
|
| 48 | 48 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
| 49 | 49 | ->join('category', 'category.category_uuid = articles.category_uuid', |
| 50 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left') |
|
| 51 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
| 52 | - ->where(['articles.article_id' => $id]); |
|
| 50 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left') |
|
| 51 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
| 52 | + ->where([ 'articles.article_id' => $id ]); |
|
| 53 | 53 | |
| 54 | 54 | return $this->selectWith($select)->current(); |
| 55 | 55 | } |
@@ -58,16 +58,16 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $select = $this->getSql()->select() |
| 60 | 60 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
| 61 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug']) |
|
| 62 | - ->where(['articles.status' => 1]) |
|
| 61 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ]) |
|
| 62 | + ->where([ 'articles.status' => 1 ]) |
|
| 63 | 63 | ->limit(1); |
| 64 | 64 | |
| 65 | - if($direction > 0) { |
|
| 65 | + if ($direction > 0) { |
|
| 66 | 66 | $select->where->greaterThan('published_at', $publishedAt); |
| 67 | - $select->order(['published_at' => 'asc']); |
|
| 68 | - } elseif($direction < 0) { |
|
| 67 | + $select->order([ 'published_at' => 'asc' ]); |
|
| 68 | + } elseif ($direction < 0) { |
|
| 69 | 69 | $select->where->lessThan('published_at', $publishedAt); |
| 70 | - $select->order(['published_at' => 'desc']); |
|
| 70 | + $select->order([ 'published_at' => 'desc' ]); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | return $this->selectWith($select)->current(); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | $select = $this->getSql()->select() |
| 79 | 79 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
| 80 | - ->where(['article_posts.is_homepage' => true, 'articles.status' => 1]); |
|
| 80 | + ->where([ 'article_posts.is_homepage' => true, 'articles.status' => 1 ]); |
|
| 81 | 81 | |
| 82 | 82 | return $this->selectWith($select)->current(); |
| 83 | 83 | } |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | public function getBySlug($slug) |
| 86 | 86 | { |
| 87 | 87 | $select = $this->getSql()->select() |
| 88 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img']) |
|
| 88 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ]) |
|
| 89 | 89 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
| 90 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['category_name' => 'name', 'category_slug' => 'slug']) |
|
| 91 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name']) |
|
| 92 | - ->where(['articles.slug' => $slug, 'articles.status' => 1]); |
|
| 90 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_name' => 'name', 'category_slug' => 'slug' ]) |
|
| 91 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ]) |
|
| 92 | + ->where([ 'articles.slug' => $slug, 'articles.status' => 1 ]); |
|
| 93 | 93 | |
| 94 | 94 | return $this->selectWith($select)->current(); |
| 95 | 95 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | public function getAll() |
| 98 | 98 | { |
| 99 | 99 | $select = $this->getSql()->select() |
| 100 | - ->join('articles', 'article_posts.article_uuid = articles.article_uuid', ['article_id', 'slug']); |
|
| 100 | + ->join('articles', 'article_posts.article_uuid = articles.article_uuid', [ 'article_id', 'slug' ]); |
|
| 101 | 101 | |
| 102 | 102 | return $this->selectWith($select); |
| 103 | 103 | } |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $select = $this->getSql()->select() |
| 108 | 108 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
| 109 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name']) |
|
| 109 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ]) |
|
| 110 | 110 | ->join('category', 'category.category_uuid = articles.category_uuid', |
| 111 | - ['category_name' => 'name', 'category_id', 'category_slug' => 'slug']) |
|
| 112 | - ->where(['articles.status' => 1]) |
|
| 113 | - ->order(['articles.published_at' => 'desc']) |
|
| 111 | + [ 'category_name' => 'name', 'category_id', 'category_slug' => 'slug' ]) |
|
| 112 | + ->where([ 'articles.status' => 1 ]) |
|
| 113 | + ->order([ 'articles.published_at' => 'desc' ]) |
|
| 114 | 114 | ->limit($limit); |
| 115 | 115 | |
| 116 | 116 | return $this->selectWith($select); |
@@ -18,13 +18,13 @@ discard block |
||
| 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 |
||
| 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(); |
@@ -40,7 +40,7 @@ discard block |
||
| 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 |
||
| 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 |
@@ -11,19 +11,19 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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(); |
@@ -18,13 +18,13 @@ discard block |
||
| 18 | 18 | $allUsers = array_column($articlePosts->getAdapter()->fetchAll('select admin_user_uuid from admin_users'), 'admin_user_uuid'); |
| 19 | 19 | $allCategory = array_column($articlePosts->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, |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | 'title' => $title, |
| 47 | 47 | 'body' => $faker->paragraph(15), |
| 48 | 48 | 'lead' => $faker->paragraph(5), |
| 49 | - 'featured_img' => $featuredImages[rand(0, (count($featuredImages) - 1))], |
|
| 50 | - 'main_img' => $mainImages[rand(0, (count($mainImages) - 1))], |
|
| 49 | + 'featured_img' => $featuredImages[ rand(0, (count($featuredImages) - 1)) ], |
|
| 50 | + 'main_img' => $mainImages[ rand(0, (count($mainImages) - 1)) ], |
|
| 51 | 51 | 'has_layout' => true, |
| 52 | 52 | 'is_homepage' => false, |
| 53 | 53 | ]; |
@@ -11,7 +11,7 @@ |
||
| 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; |
@@ -26,13 +26,13 @@ discard block |
||
| 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 |
||
| 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(); |