@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public $lastPage; |
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Reference to the page name for linking to posts. |
|
| 66 | - * @var string |
|
| 67 | - */ |
|
| 64 | + /** |
|
| 65 | + * Reference to the page name for linking to posts. |
|
| 66 | + * @var string |
|
| 67 | + */ |
|
| 68 | 68 | public $postPage; |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | ->orWhere('slug', $this->property('tag')) |
| 163 | 163 | ->with(['posts' => function($posts) { |
| 164 | 164 | $posts->skip($this->resultsPerPage * ($this->currentPage - 1)) |
| 165 | - ->take($this->resultsPerPage); |
|
| 165 | + ->take($this->resultsPerPage); |
|
| 166 | 166 | }]) |
| 167 | 167 | ->first(); |
| 168 | 168 | |
@@ -218,8 +218,12 @@ |
||
| 218 | 218 | $this->lastPage = ceil($this->totalPosts / $this->resultsPerPage); |
| 219 | 219 | |
| 220 | 220 | // Prevent the current page from being one that doesn't exist |
| 221 | - if ($this->currentPage < 1) $this->currentPage = 1; |
|
| 222 | - if ($this->currentPage > $this->lastPage) $this->currentPage = $this->lastPage; |
|
| 221 | + if ($this->currentPage < 1) { |
|
| 222 | + $this->currentPage = 1; |
|
| 223 | + } |
|
| 224 | + if ($this->currentPage > $this->lastPage) { |
|
| 225 | + $this->currentPage = $this->lastPage; |
|
| 226 | + } |
|
| 223 | 227 | |
| 224 | 228 | // Calculate the previous page |
| 225 | 229 | $this->previousPage = $this->currentPage > 1 |
@@ -130,8 +130,9 @@ |
||
| 130 | 130 | $query->orderBy($key, $this->property('direction')); |
| 131 | 131 | |
| 132 | 132 | // Limit the number of results |
| 133 | - if ($take = intval($this->property('results'))) |
|
| 134 | - $query->take($take); |
|
| 133 | + if ($take = intval($this->property('results'))) { |
|
| 134 | + $query->take($take); |
|
| 135 | + } |
|
| 135 | 136 | |
| 136 | 137 | $tags = $query->get(); |
| 137 | 138 | |
@@ -121,8 +121,9 @@ |
||
| 121 | 121 | ->first(); |
| 122 | 122 | |
| 123 | 123 | // Abort if there is no source, or it has no tags |
| 124 | - if (!$post || (!$tagIds = $post->tags->lists('id'))) |
|
| 125 | - return; |
|
| 124 | + if (!$post || (!$tagIds = $post->tags->lists('id'))) { |
|
| 125 | + return; |
|
| 126 | + } |
|
| 126 | 127 | |
| 127 | 128 | // Start building our query for related posts |
| 128 | 129 | $query = Post::isPublished() |