@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | if (\Request::isMethod('get') && $searchTerm) { |
| 188 | 188 | // add ?cats[] query string |
| 189 | 189 | $cats = Input::get('cat'); |
| 190 | - $query = http_build_query(['cat' => $cats]); |
|
| 190 | + $query = http_build_query([ 'cat' => $cats ]); |
|
| 191 | 191 | $query = preg_replace('/%5B[0-9]+%5D/simU', '%5B%5D', $query); |
| 192 | 192 | $query = !empty($query) ? '?' . $query : ''; |
| 193 | 193 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $currentPage = $this->property('pageNumber'); |
| 210 | 210 | |
| 211 | 211 | if ($currentPage > ($lastPage = $this->posts->lastPage()) && $currentPage > 1) { |
| 212 | - return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage])); |
|
| 212 | + return Redirect::to($this->currentPageUrl([ $pageNumberParam => $lastPage ])); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -238,25 +238,25 @@ discard block |
||
| 238 | 238 | protected function listPosts() |
| 239 | 239 | { |
| 240 | 240 | // get posts in excluded category |
| 241 | - $blockedPosts = []; |
|
| 242 | - $categories = BlogCategory::with(['posts' => function ($q) { |
|
| 241 | + $blockedPosts = [ ]; |
|
| 242 | + $categories = BlogCategory::with([ 'posts' => function($q) { |
|
| 243 | 243 | $q->select('post_id'); |
| 244 | - }]) |
|
| 244 | + } ]) |
|
| 245 | 245 | ->whereIn('id', $this->property('excludeCategories')) |
| 246 | 246 | ->get(); |
| 247 | 247 | |
| 248 | - $categories->each(function ($item) use (&$blockedPosts) { |
|
| 249 | - $item->posts->each(function ($item) use (&$blockedPosts) { |
|
| 250 | - $blockedPosts[] = $item->post_id; |
|
| 248 | + $categories->each(function($item) use (&$blockedPosts) { |
|
| 249 | + $item->posts->each(function($item) use (&$blockedPosts) { |
|
| 250 | + $blockedPosts[ ] = $item->post_id; |
|
| 251 | 251 | }); |
| 252 | 252 | }); |
| 253 | 253 | |
| 254 | 254 | // Filter posts |
| 255 | - $posts = BlogPost::with(['categories' => function ($q) { |
|
| 255 | + $posts = BlogPost::with([ 'categories' => function($q) { |
|
| 256 | 256 | $q->whereNotIn('id', $this->property('excludeCategories')); |
| 257 | - }]) |
|
| 257 | + } ]) |
|
| 258 | 258 | ->whereNotIn('id', $blockedPosts) |
| 259 | - ->where(function ($q) { |
|
| 259 | + ->where(function($q) { |
|
| 260 | 260 | $q->where('title', 'LIKE', "%{$this->searchTerm}%") |
| 261 | 261 | ->orWhere('content', 'LIKE', "%{$this->searchTerm}%") |
| 262 | 262 | ->orWhere('excerpt', 'LIKE', "%{$this->searchTerm}%"); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | // filter categories |
| 266 | 266 | $cat = Input::get('cat'); |
| 267 | 267 | if ($cat) { |
| 268 | - $cat = is_array($cat) ? $cat : [$cat]; |
|
| 268 | + $cat = is_array($cat) ? $cat : [ $cat ]; |
|
| 269 | 269 | $posts->filterCategories($cat); |
| 270 | 270 | } |
| 271 | 271 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * @var array |
| 20 | 20 | */ |
| 21 | - public $categories = []; |
|
| 21 | + public $categories = [ ]; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * @var bool |