@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Web\Action; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Web\Action; |
6 | 6 |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | 'select category_uuid from category where type = ' . \Article\Entity\ArticleType::EVENT), 'category_uuid' |
21 | 21 | ); |
22 | 22 | |
23 | - for($i = 0; $i < $count; $i++) { |
|
23 | + for ($i = 0; $i < $count; $i++) { |
|
24 | 24 | // Insert Article |
25 | 25 | $id = $faker->uuid; |
26 | 26 | $mysqlUuid = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary()); |
27 | 27 | $title = $faker->sentence(); |
28 | - $userUuid = $allUsers[rand(0, (count($allUsers) - 1))]; |
|
29 | - $categoryUuid = $allCategory[rand(0, (count($allCategory) - 1))]; |
|
28 | + $userUuid = $allUsers[ rand(0, (count($allUsers) - 1)) ]; |
|
29 | + $categoryUuid = $allCategory[ rand(0, (count($allCategory) - 1)) ]; |
|
30 | 30 | $data = [ |
31 | 31 | 'article_uuid' => $mysqlUuid, |
32 | 32 | 'article_id' => $id, |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | 'start_at' => $faker->dateTimeBetween('now', '+5 days')->format('Y-m-d H:i:s'), |
55 | 55 | 'end_at' => $faker->dateTimeBetween('+5 days', '+6 days')->format('Y-m-d H:i:s'), |
56 | 56 | 'event_url' => 'https://www.meetup.com/Tokyo-Hello-Kitty-Meetup/', |
57 | - 'featured_img' => $featuredImages[rand(0, (count($featuredImages) - 1))], |
|
58 | - 'main_img' => $mainImages[rand(0, (count($mainImages) - 1))] |
|
57 | + 'featured_img' => $featuredImages[ rand(0, (count($featuredImages) - 1)) ], |
|
58 | + 'main_img' => $mainImages[ rand(0, (count($mainImages) - 1)) ] |
|
59 | 59 | ]; |
60 | 60 | |
61 | 61 | $articleEvents->insert($data)->save(); |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | 'select category_uuid from category where type = ' . \Article\Entity\ArticleType::POST), 'category_uuid' |
21 | 21 | ); |
22 | 22 | |
23 | - for($i = 0; $i < $count; $i++) { |
|
23 | + for ($i = 0; $i < $count; $i++) { |
|
24 | 24 | // Insert Article |
25 | 25 | $id = $faker->uuid; |
26 | 26 | $mysqlUuid = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary()); |
27 | 27 | $title = $faker->sentence(); |
28 | - $userUuid = $allUsers[rand(0, (count($allUsers) - 1))]; |
|
29 | - $categoryUuid = $allCategory[rand(0, (count($allCategory) - 1))]; |
|
28 | + $userUuid = $allUsers[ rand(0, (count($allUsers) - 1)) ]; |
|
29 | + $categoryUuid = $allCategory[ rand(0, (count($allCategory) - 1)) ]; |
|
30 | 30 | $data = [ |
31 | 31 | 'article_uuid' => $mysqlUuid, |
32 | 32 | 'article_id' => $id, |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | 'title' => $title, |
49 | 49 | 'body' => $faker->paragraph(15), |
50 | 50 | 'lead' => $faker->paragraph(5), |
51 | - 'featured_img' => $featuredImages[rand(0, (count($featuredImages) - 1))], |
|
52 | - 'main_img' => $mainImages[rand(0, (count($mainImages) - 1))], |
|
51 | + 'featured_img' => $featuredImages[ rand(0, (count($featuredImages) - 1)) ], |
|
52 | + 'main_img' => $mainImages[ rand(0, (count($mainImages) - 1)) ], |
|
53 | 53 | 'has_layout' => true, |
54 | 54 | ]; |
55 | 55 |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | 'select category_uuid from category where type = ' . \Article\Entity\ArticleType::VIDEO), 'category_uuid' |
29 | 29 | ); |
30 | 30 | |
31 | - for($i = 0; $i < $count; $i++) { |
|
31 | + for ($i = 0; $i < $count; $i++) { |
|
32 | 32 | // Insert Article |
33 | 33 | $id = $faker->uuid; |
34 | 34 | $mysqlUuid = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary()); |
35 | 35 | $title = $faker->sentence(); |
36 | - $userUuid = $allUsers[rand(0, (count($allUsers) - 1))]; |
|
37 | - $categoryUuid = $allCategory[rand(0, (count($allCategory) - 1))]; |
|
36 | + $userUuid = $allUsers[ rand(0, (count($allUsers) - 1)) ]; |
|
37 | + $categoryUuid = $allCategory[ rand(0, (count($allCategory) - 1)) ]; |
|
38 | 38 | $data = [ |
39 | 39 | 'article_uuid' => $mysqlUuid, |
40 | 40 | 'article_id' => $id, |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | 'sub_title' => $faker->sentence(), |
59 | 59 | 'body' => $faker->paragraph(30), |
60 | 60 | 'lead' => $faker->paragraph(5), |
61 | - 'video_url' => self::VIDEOS[rand(0, (count(self::VIDEOS) - 1))], |
|
62 | - 'featured_img' => $featuredImages[rand(0, (count($featuredImages) - 1))], |
|
63 | - 'main_img' => $mainImages[rand(0, (count($mainImages) - 1))] |
|
61 | + 'video_url' => self::VIDEOS[ rand(0, (count(self::VIDEOS) - 1)) ], |
|
62 | + 'featured_img' => $featuredImages[ rand(0, (count($featuredImages) - 1)) ], |
|
63 | + 'main_img' => $mainImages[ rand(0, (count($mainImages) - 1)) ] |
|
64 | 64 | ]; |
65 | 65 | |
66 | 66 | $articleVideos->insert($data)->save(); |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | ->join( |
37 | 37 | 'articles', |
38 | 38 | 'article_videos.article_uuid = articles.article_uuid', |
39 | - ['slug', 'published_at', 'status', 'article_id'] |
|
39 | + [ 'slug', 'published_at', 'status', 'article_id' ] |
|
40 | 40 | )->join( |
41 | 41 | 'admin_users', |
42 | 42 | 'admin_users.admin_user_uuid = articles.admin_user_uuid', |
43 | - ['admin_user_id', 'first_name', 'last_name'] |
|
44 | - )->where(['articles.type' => ArticleType::VIDEO]) |
|
45 | - ->order(['articles.created_at' => 'desc']); |
|
43 | + [ 'admin_user_id', 'first_name', 'last_name' ] |
|
44 | + )->where([ 'articles.type' => ArticleType::VIDEO ]) |
|
45 | + ->order([ 'articles.created_at' => 'desc' ]); |
|
46 | 46 | |
47 | 47 | if ($isActive !== null) { |
48 | - $select->where(['articles.status' => (int)$isActive]); |
|
48 | + $select->where([ 'articles.status' => (int) $isActive ]); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $select; |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | public function get($id) |
55 | 55 | { |
56 | 56 | $select = $this->getSql()->select() |
57 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title']) |
|
57 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title' ]) |
|
58 | 58 | ->join('articles', 'article_videos.article_uuid = articles.article_uuid') |
59 | 59 | ->join( |
60 | 60 | 'category', 'category.category_uuid = articles.category_uuid', |
61 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left' |
|
61 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left' |
|
62 | 62 | ) |
63 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
64 | - ->where(['articles.article_id' => $id]); |
|
63 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
64 | + ->where([ 'articles.article_id' => $id ]); |
|
65 | 65 | |
66 | 66 | return $this->selectWith($select)->current(); |
67 | 67 | } |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | public function getLatest($limit = 50) |
70 | 70 | { |
71 | 71 | $select = $this->getSql()->select() |
72 | - ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at']) |
|
73 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug']) |
|
74 | - ->where(['articles.status' => 1]) |
|
75 | - ->order(['published_at' => 'desc']) |
|
72 | + ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
73 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ]) |
|
74 | + ->where([ 'articles.status' => 1 ]) |
|
75 | + ->order([ 'published_at' => 'desc' ]) |
|
76 | 76 | ->limit($limit); |
77 | 77 | |
78 | 78 | return $this->selectWith($select); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | $select = $this->getSql()->select() |
84 | 84 | ->join('articles', 'article_videos.article_uuid = articles.article_uuid') |
85 | - ->where(['articles.slug' => $slug]); |
|
85 | + ->where([ 'articles.slug' => $slug ]); |
|
86 | 86 | |
87 | 87 | return $this->selectWith($select)->current(); |
88 | 88 | } |