@@ -19,37 +19,37 @@ discard block |
||
19 | 19 | |
20 | 20 | public function getInputFilter() |
21 | 21 | { |
22 | - if(!$this->inputFilter) { |
|
22 | + if (!$this->inputFilter) { |
|
23 | 23 | $inputFilter = new InputFilter(); |
24 | 24 | |
25 | 25 | $inputFilter->add([ |
26 | 26 | 'name' => 'first_name', |
27 | 27 | 'required' => true, |
28 | - 'filters' => [['name' => 'StringTrim']], |
|
28 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
29 | 29 | 'validators' => [ |
30 | - ['name' => 'NotEmpty'], |
|
31 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 255]] |
|
30 | + [ 'name' => 'NotEmpty' ], |
|
31 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 255 ] ] |
|
32 | 32 | ], |
33 | 33 | ]); |
34 | 34 | |
35 | 35 | $inputFilter->add([ |
36 | 36 | 'name' => 'last_name', |
37 | 37 | 'required' => true, |
38 | - 'filters' => [['name' => 'StringTrim']], |
|
38 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
39 | 39 | 'validators' => [ |
40 | - ['name' => 'NotEmpty'], |
|
41 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 255]] |
|
40 | + [ 'name' => 'NotEmpty' ], |
|
41 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 255 ] ] |
|
42 | 42 | ], |
43 | 43 | ]); |
44 | 44 | |
45 | 45 | $inputFilter->add([ |
46 | 46 | 'name' => 'email', |
47 | 47 | 'required' => true, |
48 | - 'filters' => [['name' => 'StringTrim']], |
|
48 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
49 | 49 | 'validators' => [ |
50 | - ['name' => 'NotEmpty'], |
|
51 | - ['name' => 'EmailAddress'], |
|
52 | - ['name' => 'dbnorecordexists', 'options' => ['adapter' => $this->adapter, 'table' => 'admin_users', 'field' => 'email']], |
|
50 | + [ 'name' => 'NotEmpty' ], |
|
51 | + [ 'name' => 'EmailAddress' ], |
|
52 | + [ 'name' => 'dbnorecordexists', 'options' => [ 'adapter' => $this->adapter, 'table' => 'admin_users', 'field' => 'email' ] ], |
|
53 | 53 | |
54 | 54 | ], |
55 | 55 | ]); |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | $inputFilter->add([ |
58 | 58 | 'name' => 'introduction', |
59 | 59 | 'required' => false, |
60 | - 'filters' => [['name' => 'StringTrim']] |
|
60 | + 'filters' => [ [ 'name' => 'StringTrim' ] ] |
|
61 | 61 | ]); |
62 | 62 | |
63 | 63 | $inputFilter->add([ |
64 | 64 | 'name' => 'password', |
65 | 65 | 'required' => true, |
66 | 66 | 'validators' => [ |
67 | - ['name' => 'NotEmpty'], |
|
68 | - ['name' => 'StringLength', 'options' => ['min' => 7, 'max' => 255]] |
|
67 | + [ 'name' => 'NotEmpty' ], |
|
68 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 7, 'max' => 255 ] ] |
|
69 | 69 | ], |
70 | 70 | ]); |
71 | 71 | |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | 'name' => 'confirm_password', |
74 | 74 | 'required' => true, |
75 | 75 | 'validators' => [ |
76 | - ['name' => 'NotEmpty'], |
|
77 | - ['name' => 'Identical', 'options' => ['token' => 'password']], |
|
76 | + [ 'name' => 'NotEmpty' ], |
|
77 | + [ 'name' => 'Identical', 'options' => [ 'token' => 'password' ] ], |
|
78 | 78 | ], |
79 | 79 | ]); |
80 | 80 | |
81 | 81 | $inputFilter->add([ |
82 | 82 | 'name' => 'status', |
83 | 83 | 'required' => true, |
84 | - 'validators' => [['name' => 'NotEmpty'], ['name' => 'Digits']] |
|
84 | + 'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Digits' ] ] |
|
85 | 85 | ]); |
86 | 86 | |
87 | 87 | $this->inputFilter = $inputFilter; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Core\Factory\Service; |
5 | 5 | |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __invoke(ContainerInterface $container): AdminUserService |
22 | 22 | { |
23 | - $config = $container->get('config')['upload']; |
|
24 | - $upload = new Upload($config['public_path'], $config['non_public_path']); |
|
23 | + $config = $container->get('config')[ 'upload' ]; |
|
24 | + $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]); |
|
25 | 25 | |
26 | 26 | return new AdminUserService( |
27 | 27 | new Bcrypt(), |
@@ -8,25 +8,25 @@ |
||
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('email', 'string', ['limit' => 128]) |
|
18 | - ->addColumn('password', 'char', ['limit' => 60]) |
|
19 | - ->addColumn('status', 'integer', ['default' => 0])// 0 => not active, 1 = active |
|
20 | - ->addColumn('face_img', 'text', ['null' => true]) |
|
21 | - ->addColumn('profile_img', 'text', ['null' => true]) |
|
22 | - ->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP']) |
|
23 | - ->addColumn('last_login', 'datetime', ['null' => true]) |
|
24 | - ->addIndex(['email'], ['name' => 'email_INDEX']) |
|
16 | + ->addColumn('introduction', 'text', [ 'null' => true ]) |
|
17 | + ->addColumn('email', 'string', [ 'limit' => 128 ]) |
|
18 | + ->addColumn('password', 'char', [ 'limit' => 60 ]) |
|
19 | + ->addColumn('status', 'integer', [ 'default' => 0 ])// 0 => not active, 1 = active |
|
20 | + ->addColumn('face_img', 'text', [ 'null' => true ]) |
|
21 | + ->addColumn('profile_img', 'text', [ 'null' => true ]) |
|
22 | + ->addColumn('created_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ]) |
|
23 | + ->addColumn('last_login', 'datetime', [ 'null' => true ]) |
|
24 | + ->addIndex([ 'email' ], [ 'name' => 'email_INDEX' ]) |
|
25 | 25 | ->create(); |
26 | 26 | |
27 | 27 | $faker = Faker\Factory::create(); |
28 | 28 | $count = rand(100, 150); |
29 | - for($i = 0; $i < $count; $i++) { |
|
29 | + for ($i = 0; $i < $count; $i++) { |
|
30 | 30 | $id = $faker->uuid; |
31 | 31 | $mysqluuid = (new Uuid($id))->toFormat(new Binary()); |
32 | 32 | $data = [ |
@@ -9,8 +9,8 @@ |
||
9 | 9 | |
10 | 10 | public function up() |
11 | 11 | { |
12 | - $this->table('category', ['id' => false, 'primary_key' => 'category_uuid']) |
|
13 | - ->addColumn('category_uuid', 'binary', ['limit' => 16]) |
|
12 | + $this->table('category', [ 'id' => false, 'primary_key' => 'category_uuid' ]) |
|
13 | + ->addColumn('category_uuid', 'binary', [ 'limit' => 16 ]) |
|
14 | 14 | ->addColumn('category_id', 'text') |
15 | 15 | ->addColumn('name', 'text') |
16 | 16 | ->addColumn('slug', 'text') |
@@ -12,56 +12,56 @@ |
||
12 | 12 | |
13 | 13 | public function getInputFilter() |
14 | 14 | { |
15 | - if(!$this->inputFilter) { |
|
15 | + if (!$this->inputFilter) { |
|
16 | 16 | $inputFilter = new InputFilter(); |
17 | 17 | |
18 | 18 | $inputFilter->add([ |
19 | 19 | 'name' => 'title', |
20 | 20 | 'required' => true, |
21 | - 'filters' => [['name' => 'StringTrim']], |
|
21 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
22 | 22 | 'validators' => [ |
23 | - ['name' => 'NotEmpty'], |
|
24 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
23 | + [ 'name' => 'NotEmpty' ], |
|
24 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
25 | 25 | ], |
26 | 26 | ]); |
27 | 27 | |
28 | 28 | $inputFilter->add([ |
29 | 29 | 'name' => 'sub_title', |
30 | 30 | 'required' => false, |
31 | - 'filters' => [['name' => 'StringTrim']], |
|
31 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
32 | 32 | 'validators' => [ |
33 | - ['name' => 'NotEmpty'], |
|
34 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 500]], |
|
33 | + [ 'name' => 'NotEmpty' ], |
|
34 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 500 ] ], |
|
35 | 35 | ], |
36 | 36 | ]); |
37 | 37 | |
38 | 38 | $inputFilter->add([ |
39 | 39 | 'name' => 'body', |
40 | 40 | 'required' => true, |
41 | - 'filters' => [['name' => 'StringTrim']], |
|
41 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
42 | 42 | 'validators' => [ |
43 | - ['name' => 'NotEmpty'], |
|
44 | - ['name' => 'StringLength', 'options' => ['min' => 2]], |
|
43 | + [ 'name' => 'NotEmpty' ], |
|
44 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2 ] ], |
|
45 | 45 | ], |
46 | 46 | ]); |
47 | 47 | |
48 | 48 | $inputFilter->add([ |
49 | 49 | 'name' => 'lead', |
50 | 50 | 'required' => true, |
51 | - 'filters' => [['name' => 'StringTrim']], |
|
51 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
52 | 52 | 'validators' => [ |
53 | - ['name' => 'NotEmpty'], |
|
54 | - ['name' => 'StringLength', 'options' => ['min' => 2]], |
|
53 | + [ 'name' => 'NotEmpty' ], |
|
54 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2 ] ], |
|
55 | 55 | ], |
56 | 56 | ]); |
57 | 57 | |
58 | 58 | $inputFilter->add([ |
59 | 59 | 'name' => 'video_url', |
60 | 60 | 'required' => true, |
61 | - 'filters' => [['name' => 'StringTrim']], |
|
61 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
62 | 62 | 'validators' => [ |
63 | - ['name' => 'NotEmpty'], |
|
64 | - ['name' => 'StringLength'], |
|
63 | + [ 'name' => 'NotEmpty' ], |
|
64 | + [ 'name' => 'StringLength' ], |
|
65 | 65 | ], |
66 | 66 | ]); |
67 | 67 |
@@ -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::POST]) |
|
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::POST ]) |
|
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,9 +49,9 @@ 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 | - ->where(['articles.article_id' => $id]); |
|
54 | + ->where([ 'articles.article_id' => $id ]); |
|
55 | 55 | |
56 | 56 | return $this->selectWith($select)->current(); |
57 | 57 | } |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | public function getLatest($limit = 50) |
60 | 60 | { |
61 | 61 | $select = $this->getSql()->select() |
62 | - ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at']) |
|
63 | - ->where(['articles.status' => 1]) |
|
64 | - ->order(['published_at' => 'desc']) |
|
62 | + ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
63 | + ->where([ 'articles.status' => 1 ]) |
|
64 | + ->order([ 'published_at' => 'desc' ]) |
|
65 | 65 | ->limit($limit); |
66 | 66 | |
67 | 67 | return $this->selectWith($select); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | $select = $this->getSql()->select() |
73 | 73 | ->join('articles', 'article_videos.article_uuid = articles.article_uuid') |
74 | - ->where(['articles.slug' => $slug]); |
|
74 | + ->where([ 'articles.slug' => $slug ]); |
|
75 | 75 | |
76 | 76 | return $this->selectWith($select)->current(); |
77 | 77 | } |
@@ -10,16 +10,16 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -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 Web\Action; |
6 | 6 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function __invoke(Request $request, Response $response, callable $next = null) |
54 | 54 | { |
55 | 55 | $params = $request->getQueryParams(); |
56 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
56 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
57 | 57 | $futureEvents = $this->eventService->fetchFutureEvents(); |
58 | 58 | $pastEvents = $this->eventService->fetchPastEventsPagination($page, 5); |
59 | 59 |
@@ -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; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $select = $this->getSql()->select() |
55 | 55 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
56 | - ->where(['articles.article_id' => $id]); |
|
56 | + ->where([ 'articles.article_id' => $id ]); |
|
57 | 57 | |
58 | 58 | return $this->selectWith($select)->current(); |
59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $select = $this->getSql()->select() |
64 | 64 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
65 | - ->where(['articles.slug' => $slug]); |
|
65 | + ->where([ 'articles.slug' => $slug ]); |
|
66 | 66 | |
67 | 67 | return $this->selectWith($select)->current(); |
68 | 68 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | public function getLatest($limit = 50) |
71 | 71 | { |
72 | 72 | $select = $this->getSql()->select() |
73 | - ->join('articles', 'article_events.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at']) |
|
74 | - ->where(['articles.status' => 1]) |
|
75 | - ->order(['published_at' => 'desc']) |
|
73 | + ->join('articles', 'article_events.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
74 | + ->where([ 'articles.status' => 1 ]) |
|
75 | + ->order([ 'published_at' => 'desc' ]) |
|
76 | 76 | ->limit($limit); |
77 | 77 | |
78 | 78 | return $this->selectWith($select); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | public function getFuture() |
82 | 82 | { |
83 | 83 | $select = $this->getSql()->select() |
84 | - ->where(['articles.status' => 1]) |
|
85 | - ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at']) |
|
84 | + ->where([ 'articles.status' => 1 ]) |
|
85 | + ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
86 | 86 | ->order(new Expression('rand()')); |
87 | 87 | |
88 | 88 | $select->where->greaterThanOrEqualTo('end_at', date('Y-m-d H:i:s')); |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | public function getPastSelect() |
94 | 94 | { |
95 | 95 | $select = $this->getSql()->select() |
96 | - ->where(['articles.status' => 1]) |
|
97 | - ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at']) |
|
98 | - ->order(['start_at' => 'desc']); |
|
96 | + ->where([ 'articles.status' => 1 ]) |
|
97 | + ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
98 | + ->order([ 'start_at' => 'desc' ]); |
|
99 | 99 | |
100 | 100 | $select->where->lessThan('end_at', date('Y-m-d H:i:s')); |
101 | 101 |