@@ -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 |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | if (!$this->property('disableUrlMapping') && \Request::isMethod('get') && $searchTerm) { |
| 210 | 210 | // add ?cats[] query string |
| 211 | 211 | $cats = Input::get('cat'); |
| 212 | - $query = http_build_query(['cat' => $cats]); |
|
| 212 | + $query = http_build_query([ 'cat' => $cats ]); |
|
| 213 | 213 | $query = preg_replace('/%5B[0-9]+%5D/simU', '%5B%5D', $query); |
| 214 | 214 | $query = !empty($query) ? '?' . $query : ''; |
| 215 | 215 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $currentPage = $this->property('pageNumber'); |
| 232 | 232 | |
| 233 | 233 | if ($currentPage > ($lastPage = $this->posts->lastPage()) && $currentPage > 1) { |
| 234 | - return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage])); |
|
| 234 | + return Redirect::to($this->currentPageUrl([ $pageNumberParam => $lastPage ])); |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | { |
| 266 | 266 | // Filter posts |
| 267 | 267 | $posts = BlogPost::with([ |
| 268 | - 'categories' => function ($q) { |
|
| 268 | + 'categories' => function($q) { |
|
| 269 | 269 | if (!is_null($this->property('excludeCategories'))) { |
| 270 | 270 | $q->whereNotIn('id', $this->property('excludeCategories')); |
| 271 | 271 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | ]) |
| 277 | - ->where(function ($q) { |
|
| 277 | + ->where(function($q) { |
|
| 278 | 278 | $q->where('title', 'LIKE', "%{$this->searchTerm}%") |
| 279 | 279 | ->orWhere('content', 'LIKE', "%{$this->searchTerm}%") |
| 280 | 280 | ->orWhere('excerpt', 'LIKE', "%{$this->searchTerm}%"); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | // filter categories |
| 284 | 284 | $cat = Input::get('cat'); |
| 285 | 285 | if ($cat) { |
| 286 | - $cat = is_array($cat) ? $cat : [$cat]; |
|
| 286 | + $cat = is_array($cat) ? $cat : [ $cat ]; |
|
| 287 | 287 | $posts->filterCategories($cat); |
| 288 | 288 | } |
| 289 | 289 | |
@@ -309,10 +309,10 @@ discard block |
||
| 309 | 309 | /* |
| 310 | 310 | * Add a "url" helper attribute for linking to each post and category |
| 311 | 311 | */ |
| 312 | - $posts->each(function ($post) { |
|
| 312 | + $posts->each(function($post) { |
|
| 313 | 313 | $post->setUrl($this->postPage, $this->controller); |
| 314 | 314 | |
| 315 | - $post->categories->each(function ($category) { |
|
| 315 | + $post->categories->each(function($category) { |
|
| 316 | 316 | $category->setUrl($this->categoryPage, $this->controller); |
| 317 | 317 | }); |
| 318 | 318 | |
@@ -331,19 +331,19 @@ discard block |
||
| 331 | 331 | protected function getPostIdsByCategories($ids = null) |
| 332 | 332 | { |
| 333 | 333 | if (is_null($ids) || !is_array($ids)) { |
| 334 | - return []; |
|
| 334 | + return [ ]; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - $posts = []; |
|
| 338 | - $categories = BlogCategory::with(['posts' => function ($q) { |
|
| 337 | + $posts = [ ]; |
|
| 338 | + $categories = BlogCategory::with([ 'posts' => function($q) { |
|
| 339 | 339 | $q->select('post_id'); |
| 340 | - }]) |
|
| 340 | + } ]) |
|
| 341 | 341 | ->whereIn('id', $ids) |
| 342 | 342 | ->get(); |
| 343 | 343 | |
| 344 | - $categories->each(function ($item) use (&$posts) { |
|
| 345 | - $item->posts->each(function ($item) use (&$posts) { |
|
| 346 | - $posts[] = $item->post_id; |
|
| 344 | + $categories->each(function($item) use (&$posts) { |
|
| 345 | + $item->posts->each(function($item) use (&$posts) { |
|
| 346 | + $posts[ ] = $item->post_id; |
|
| 347 | 347 | }); |
| 348 | 348 | }); |
| 349 | 349 | |
@@ -46,13 +46,13 @@ |
||
| 46 | 46 | { |
| 47 | 47 | // Check the translate plugin is installed |
| 48 | 48 | if (class_exists('RainLab\Translate\Behaviors\TranslatableModel')) { |
| 49 | - return []; |
|
| 49 | + return [ ]; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | return [ |
| 53 | 53 | 'filters' => [ |
| 54 | - '_' => ['Lang', 'get'], |
|
| 55 | - '__' => ['Lang', 'choice'], |
|
| 54 | + '_' => [ 'Lang', 'get' ], |
|
| 55 | + '__' => [ 'Lang', 'choice' ], |
|
| 56 | 56 | ] |
| 57 | 57 | ]; |
| 58 | 58 | } |