@@ -86,7 +86,7 @@ |
||
86 | 86 | * |
87 | 87 | * @var array |
88 | 88 | */ |
89 | - public static $sortingOptions = [ |
|
89 | + public static $sortingOptions = [ |
|
90 | 90 | 'name asc' => Plugin::LOCALIZATION_KEY . 'order_options.name_asc', |
91 | 91 | 'name desc' => Plugin::LOCALIZATION_KEY . 'order_options.name_desc', |
92 | 92 | 'created_at asc' => Plugin::LOCALIZATION_KEY . 'order_options.created_at_asc', |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @var array |
48 | 48 | */ |
49 | - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; |
|
49 | + public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ]; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Translatable properties, indexed property will be available in queries |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * @var array |
66 | 66 | */ |
67 | - protected $slugs = ['slug' => 'name']; |
|
67 | + protected $slugs = [ 'slug' => 'name' ]; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Relations |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @var array |
73 | 73 | */ |
74 | 74 | public $morphedByMany = [ |
75 | - 'posts' => [Post::class, 'name' => Tag::PIVOT_COLUMN], |
|
76 | - 'series' => [Series::class, 'name' => Tag::PIVOT_COLUMN], |
|
75 | + 'posts' => [ Post::class, 'name' => Tag::PIVOT_COLUMN ], |
|
76 | + 'series' => [ Series::class, 'name' => Tag::PIVOT_COLUMN ], |
|
77 | 77 | ]; |
78 | 78 | |
79 | 79 | /** |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | { |
183 | 183 | parent::queryPostSlug($query, $options); |
184 | 184 | |
185 | - if (!empty($options['post']) && !empty($options['includeSeriesTags'])) { |
|
186 | - $query->orWhereHas('series', static function ($query) use ($options) { |
|
185 | + if (!empty($options[ 'post' ]) && !empty($options[ 'includeSeriesTags' ])) { |
|
186 | + $query->orWhereHas('series', static function($query) use ($options) { |
|
187 | 187 | $query->whereHas( |
188 | 188 | 'posts', |
189 | - static function ($query) use ($options) { |
|
190 | - ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']); |
|
189 | + static function($query) use ($options) { |
|
190 | + ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]); |
|
191 | 191 | }); |
192 | 192 | }); |
193 | 193 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | protected function queryDisplayEmpty(Builder $query, array $options) |
203 | 203 | { |
204 | - if (empty($options['displayEmpty'])) { |
|
204 | + if (empty($options[ 'displayEmpty' ])) { |
|
205 | 205 | $query |
206 | 206 | ->having('posts_count', '>', 0) |
207 | 207 | ->orHaving('series_count', '>', 0); |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | */ |
217 | 217 | private function postRelation(Builder $query, array $options) |
218 | 218 | { |
219 | - if (!empty($options['fetchPosts'])) { |
|
219 | + if (!empty($options[ 'fetchPosts' ])) { |
|
220 | 220 | $query->with( |
221 | 221 | [ |
222 | - 'posts' => static function (MorphToMany $query) use ($options) { |
|
222 | + 'posts' => static function(MorphToMany $query) use ($options) { |
|
223 | 223 | $query->isPublished(); |
224 | 224 | |
225 | 225 | self::handleExceptions($query->getQuery(), $options); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | $query->withCount( |
232 | 232 | [ |
233 | - 'posts' => static function ($query) use ($options) { |
|
233 | + 'posts' => static function($query) use ($options) { |
|
234 | 234 | $query->isPublished(); |
235 | 235 | |
236 | 236 | self::handleExceptions($query, $options); |
@@ -249,13 +249,13 @@ discard block |
||
249 | 249 | { |
250 | 250 | $query->withCount('series'); |
251 | 251 | |
252 | - if (!empty($options['fetchSeriesPostCount'])) { |
|
252 | + if (!empty($options[ 'fetchSeriesPostCount' ])) { |
|
253 | 253 | $query->with( |
254 | 254 | [ |
255 | - 'series' => static function (MorphToMany $query) use ($options) { |
|
255 | + 'series' => static function(MorphToMany $query) use ($options) { |
|
256 | 256 | $query->withCount( |
257 | 257 | [ |
258 | - 'posts' => static function ($query) use ($options) { |
|
258 | + 'posts' => static function($query) use ($options) { |
|
259 | 259 | $query->isPublished(); |
260 | 260 | |
261 | 261 | self::handleExceptions($query, $options); |
@@ -109,8 +109,8 @@ |
||
109 | 109 | { |
110 | 110 | $this->postPage = $this->property('postPage'); |
111 | 111 | $this->seriesPage = $this->property('seriesPage'); |
112 | - $this->slug = $this->page['slug'] = $this->property('slug'); |
|
113 | - $this->series = $this->page['series'] = $this->listSeries(); |
|
112 | + $this->slug = $this->page[ 'slug' ] = $this->property('slug'); |
|
113 | + $this->series = $this->page[ 'series' ] = $this->listSeries(); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -64,7 +64,7 @@ |
||
64 | 64 | */ |
65 | 65 | protected function getPostsQuery() |
66 | 66 | { |
67 | - $query = Post::whereHas('series', function ($query) { |
|
67 | + $query = Post::whereHas('series', function($query) { |
|
68 | 68 | $query->whereTranslatable('slug', $this->series->slug); |
69 | 69 | })->isPublished(); |
70 | 70 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | { |
21 | 21 | const PLUGIN_NAME = 'PKleindienst.BlogSeries'; |
22 | 22 | |
23 | - private $migratedSeriesIds = []; |
|
23 | + private $migratedSeriesIds = [ ]; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Migrate plugin data |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ) |
91 | 91 | ); |
92 | 92 | |
93 | - $this->migratedSeriesIds[$blogTaxonomySeries->id] = $seriesRecord->id; |
|
93 | + $this->migratedSeriesIds[ $blogTaxonomySeries->id ] = $seriesRecord->id; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $this->command->info('All series have been migrated' . PHP_EOL); |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | |
118 | 118 | $migratedSeries = array_flip($this->migratedSeriesIds); |
119 | 119 | |
120 | - DB::transaction(function () use ($relatedSeries, $migratedSeries) { |
|
120 | + DB::transaction(function() use ($relatedSeries, $migratedSeries) { |
|
121 | 121 | foreach ($relatedSeries as $relationRecord) { |
122 | - $seriesId = $migratedSeries[$relationRecord->series_id]; |
|
123 | - $relatedSeriesId = $migratedSeries[$relationRecord->related_id]; |
|
122 | + $seriesId = $migratedSeries[ $relationRecord->series_id ]; |
|
123 | + $relatedSeriesId = $migratedSeries[ $relationRecord->related_id ]; |
|
124 | 124 | |
125 | 125 | DB::table('ginopane_blogtaxonomy_related_series')->insert( |
126 | - ['series_id' => $seriesId, 'related_series_id' => $relatedSeriesId] |
|
126 | + [ 'series_id' => $seriesId, 'related_series_id' => $relatedSeriesId ] |
|
127 | 127 | ); |
128 | 128 | |
129 | 129 | $this->command->line( |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | |
159 | 159 | $migratedSeries = array_flip($this->migratedSeriesIds); |
160 | 160 | |
161 | - DB::transaction(function () use ($migratedSeries) { |
|
161 | + DB::transaction(function() use ($migratedSeries) { |
|
162 | 162 | foreach ($migratedSeries as $oldSeriesId => $newSeriesId) { |
163 | 163 | if (DB::table('rainlab_blog_posts') |
164 | 164 | ->where('series_id', $oldSeriesId) |
165 | - ->update(['ginopane_blogtaxonomy_series_id' => $newSeriesId]) |
|
165 | + ->update([ 'ginopane_blogtaxonomy_series_id' => $newSeriesId ]) |
|
166 | 166 | ) { |
167 | 167 | $this->command->line( |
168 | 168 | sprintf( |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * @var Collection | array |
26 | 26 | */ |
27 | - public $posts = []; |
|
27 | + public $posts = [ ]; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Parameter to use for the page number |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->pageParam = $this->paramName('page'); |
244 | 244 | $this->currentPage = (int)$this->property('page', 1) ?: (int)post('page'); |
245 | 245 | $this->resultsPerPage = (int)$this->property('resultsPerPage') |
246 | - ?: $this->defineProperties()['resultsPerPage']['default']; |
|
246 | + ?: $this->defineProperties()[ 'resultsPerPage' ][ 'default' ]; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -50,12 +50,12 @@ |
||
50 | 50 | if (!Schema::hasTable(Series::RELATED_SERIES_TABLE_NAME)) { |
51 | 51 | Schema::create( |
52 | 52 | Series::RELATED_SERIES_TABLE_NAME, |
53 | - static function ($table) { |
|
53 | + static function($table) { |
|
54 | 54 | $table->engine = 'InnoDB'; |
55 | 55 | |
56 | 56 | $table->integer('series_id')->unsigned(); |
57 | 57 | $table->integer('related_series_id')->unsigned(); |
58 | - $table->index(['series_id', 'related_series_id'], 'related_series_index'); |
|
58 | + $table->index([ 'series_id', 'related_series_id' ], 'related_series_index'); |
|
59 | 59 | |
60 | 60 | $table |
61 | 61 | ->foreign('series_id', 'Series reference') |
@@ -73,10 +73,10 @@ |
||
73 | 73 | $series = Series::whereTranslatable('slug', $this->property('series')) |
74 | 74 | ->with( |
75 | 75 | [ |
76 | - 'related_series' => static function ($query) { |
|
76 | + 'related_series' => static function($query) { |
|
77 | 77 | $query->withCount( |
78 | 78 | [ |
79 | - 'posts' => static function ($query) { |
|
79 | + 'posts' => static function($query) { |
|
80 | 80 | $query->isPublished(); |
81 | 81 | } |
82 | 82 | ] |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @var array |
43 | 43 | */ |
44 | - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; |
|
44 | + public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ]; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Translatable properties, indexed property will be available in queries |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ]; |
71 | 71 | |
72 | 72 | public $morphToMany = [ |
73 | - 'tags' => [Tag::class, 'name' => Tag::PIVOT_COLUMN] |
|
73 | + 'tags' => [ Tag::class, 'name' => Tag::PIVOT_COLUMN ] |
|
74 | 74 | ]; |
75 | 75 | |
76 | 76 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | /** |
147 | 147 | * @var array |
148 | 148 | */ |
149 | - protected $slugs = ['slug' => 'title']; |
|
149 | + protected $slugs = [ 'slug' => 'title' ]; |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * @param Builder $query |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @var Collection | array |
27 | 27 | */ |
28 | - public $tags = []; |
|
28 | + public $tags = [ ]; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Reference to the page name for linking to tag page |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | $this->tagsPageUrl = $this->controller->pageUrl($this->tagsPage); |
366 | 366 | |
367 | - $this->setUrls($tags, $this->tagPage, $this->controller, ['tag' => $this->urlProperty($tagComponent, 'tag')]); |
|
367 | + $this->setUrls($tags, $this->tagPage, $this->controller, [ 'tag' => $this->urlProperty($tagComponent, 'tag') ]); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -406,18 +406,18 @@ discard block |
||
406 | 406 | |
407 | 407 | private function prepareVars() |
408 | 408 | { |
409 | - $this->tagPage = (string) $this->getProperty('tagPage'); |
|
410 | - $this->tagsPage = (string) $this->getProperty('tagsPage'); |
|
409 | + $this->tagPage = (string)$this->getProperty('tagPage'); |
|
410 | + $this->tagsPage = (string)$this->getProperty('tagsPage'); |
|
411 | 411 | |
412 | 412 | $this->orderBy = $this->getProperty('orderBy'); |
413 | 413 | $this->postSlug = $this->getProperty('postSlug'); |
414 | - $this->fetchPosts = (bool) $this->getProperty('fetchPosts'); |
|
415 | - $this->displayEmpty = (bool) $this->getProperty('displayEmpty'); |
|
416 | - $this->limit = (int) $this->getProperty('limit'); |
|
417 | - $this->exposeTotalCount = (bool) $this->getProperty('exposeTotalCount'); |
|
418 | - $this->enableTagFilter = (string) $this->getProperty('enableTagFilter'); |
|
419 | - $this->includeSeriesTags = (bool) $this->getProperty('includeSeriesTags'); |
|
420 | - $this->fetchSeriesPostCount = (bool) $this->getProperty('fetchSeriesPostCount'); |
|
421 | - $this->debugOutput = (bool) $this->getProperty('debugOutput'); |
|
414 | + $this->fetchPosts = (bool)$this->getProperty('fetchPosts'); |
|
415 | + $this->displayEmpty = (bool)$this->getProperty('displayEmpty'); |
|
416 | + $this->limit = (int)$this->getProperty('limit'); |
|
417 | + $this->exposeTotalCount = (bool)$this->getProperty('exposeTotalCount'); |
|
418 | + $this->enableTagFilter = (string)$this->getProperty('enableTagFilter'); |
|
419 | + $this->includeSeriesTags = (bool)$this->getProperty('includeSeriesTags'); |
|
420 | + $this->fetchSeriesPostCount = (bool)$this->getProperty('fetchSeriesPostCount'); |
|
421 | + $this->debugOutput = (bool)$this->getProperty('debugOutput'); |
|
422 | 422 | } |
423 | 423 | } |