@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @param $items |
30 | - * @param $urlPage |
|
30 | + * @param string $urlPage |
|
31 | 31 | * @param $controller |
32 | 32 | */ |
33 | 33 | public function setUrls($items, $urlPage, $controller) |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $post->setUrl($this->postPage, $this->controller); |
50 | 50 | |
51 | 51 | if ($post && $post->categories->count()) { |
52 | - $post->categories->each(function ($category) { |
|
52 | + $post->categories->each(function($category) { |
|
53 | 53 | $category->setUrl($this->categoryPage, $this->controller); |
54 | 54 | }); |
55 | 55 | } |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return mixed |
20 | 20 | */ |
21 | - public function scopeListFrontend($query, array $options = []) |
|
21 | + public function scopeListFrontend($query, array $options = [ ]) |
|
22 | 22 | { |
23 | - if (in_array($options['sort'], array_keys(self::$sortingOptions))) { |
|
24 | - if ($options['sort'] == 'random') { |
|
23 | + if (in_array($options[ 'sort' ], array_keys(self::$sortingOptions))) { |
|
24 | + if ($options[ 'sort' ] == 'random') { |
|
25 | 25 | $query->inRandomOrder(); |
26 | 26 | } else { |
27 | - list($sortField, $sortDirection) = explode(' ', $options['sort']); |
|
27 | + list($sortField, $sortDirection) = explode(' ', $options[ 'sort' ]); |
|
28 | 28 | |
29 | 29 | if ($sortField == 'posts_count') { |
30 | 30 | $query->withCount('posts'); |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | - if (empty($options['displayEmpty'])) { |
|
37 | + if (empty($options[ 'displayEmpty' ])) { |
|
38 | 38 | $query->has('posts'); |
39 | 39 | } |
40 | 40 | |
41 | 41 | // Limit the number of results |
42 | - if (!empty($options['limit'])) { |
|
43 | - $query->take($options['limit']); |
|
42 | + if (!empty($options[ 'limit' ])) { |
|
43 | + $query->take($options[ 'limit' ]); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $query->with([ |
47 | - 'posts' => function($query){ |
|
47 | + 'posts' => function($query) { |
|
48 | 48 | $query->isPublished(); |
49 | 49 | } |
50 | 50 | ] |
@@ -83,7 +83,7 @@ |
||
83 | 83 | /** |
84 | 84 | * @var array |
85 | 85 | */ |
86 | - protected $slugs = ['slug' => 'title']; |
|
86 | + protected $slugs = [ 'slug' => 'title' ]; |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @return mixed |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * @param $query |
11 | 11 | * @param array $options Available options are "sort", "displayEmpty", "limit" |
12 | 12 | */ |
13 | - public function scopeListFrontend($query, array $options = []) |
|
13 | + public function scopeListFrontend($query, array $options = [ ]) |
|
14 | 14 | { |
15 | 15 | |
16 | 16 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * @var Collection | array |
22 | 22 | */ |
23 | - public $posts = []; |
|
23 | + public $posts = [ ]; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @var integer The current page |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | { |
155 | 155 | $this->currentPage = intval($this->property('page', 1)) ?: intval(post('page')); |
156 | 156 | $this->resultsPerPage = intval($this->property('resultsPerPage')) |
157 | - ?: $this->defineProperties()['resultsPerPage']['default']; |
|
157 | + ?: $this->defineProperties()[ 'resultsPerPage' ][ 'default' ]; |
|
158 | 158 | |
159 | - $this->noPostsMessage = $this->page['noPostsMessage'] = $this->property('noPostsMessage'); |
|
160 | - $this->orderBy = $this->page['orderBy'] = $this->property('orderBy'); |
|
159 | + $this->noPostsMessage = $this->page[ 'noPostsMessage' ] = $this->property('noPostsMessage'); |
|
160 | + $this->orderBy = $this->page[ 'orderBy' ] = $this->property('orderBy'); |
|
161 | 161 | |
162 | 162 | // Page links |
163 | - $this->postPage = $this->page['postPage' ] = $this->property('postPage'); |
|
164 | - $this->categoryPage = $this->page['categoryPage'] = $this->property('categoryPage'); |
|
163 | + $this->postPage = $this->page[ 'postPage' ] = $this->property('postPage'); |
|
164 | + $this->categoryPage = $this->page[ 'categoryPage' ] = $this->property('categoryPage'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | // Add a "url" helper attribute for linking to each post and category |
187 | 187 | if ($posts && $posts->count()) { |
188 | - $posts->each([$this, 'setPostUrls']); |
|
188 | + $posts->each([ $this, 'setPostUrls' ]); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | $this->posts = $posts; |
@@ -64,7 +64,7 @@ |
||
64 | 64 | */ |
65 | 65 | protected function getPostsQuery() |
66 | 66 | { |
67 | - $query = Post::whereHas('tags', function ($query) { |
|
67 | + $query = Post::whereHas('tags', function($query) { |
|
68 | 68 | $query->where('slug', $this->tag->slug); |
69 | 69 | })->isPublished(); |
70 | 70 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @var Collection | array |
23 | 23 | */ |
24 | - public $tags = []; |
|
24 | + public $tags = [ ]; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Reference to the page name for linking to tags page |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->tagsPage = $this->property('tagsPage', ''); |
128 | 128 | $this->orderBy = $this->property('orderBy', 'name asc'); |
129 | 129 | $this->displayEmpty = $this->property('displayEmpty', false); |
130 | - $this->limit = $this->property('limit', 0); |
|
130 | + $this->limit = $this->property('limit', 0); |
|
131 | 131 | |
132 | 132 | $this->tags = $this->listTags(); |
133 | 133 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | */ |
63 | 63 | protected function getPostsQuery() |
64 | 64 | { |
65 | - $query = Post::whereHas('series', function ($query) { |
|
65 | + $query = Post::whereHas('series', function($query) { |
|
66 | 66 | $query->where('slug', $this->series->slug); |
67 | 67 | })->isPublished(); |
68 | 68 |