@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @var array |
| 42 | 42 | */ |
| 43 | - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; |
|
| 43 | + public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ]; |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Translatable properties, indexed property will be available in queries |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * @var array |
| 143 | 143 | */ |
| 144 | - protected $slugs = ['slug' => 'title']; |
|
| 144 | + protected $slugs = [ 'slug' => 'title' ]; |
|
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | 147 | * @param Builder $query |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | private function dropSeries() |
| 55 | 55 | { |
| 56 | - Schema::table('rainlab_blog_posts', function ($table) { |
|
| 57 | - $table->dropForeign([Series::TABLE_NAME . '_id']); |
|
| 56 | + Schema::table('rainlab_blog_posts', function($table) { |
|
| 57 | + $table->dropForeign([ Series::TABLE_NAME . '_id' ]); |
|
| 58 | 58 | $table->dropColumn(Series::TABLE_NAME . '_id'); |
| 59 | 59 | }); |
| 60 | 60 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | if (!Schema::hasTable(Tag::TABLE_NAME)) { |
| 70 | 70 | Schema::create( |
| 71 | 71 | Tag::TABLE_NAME, |
| 72 | - static function ($table) { |
|
| 72 | + static function($table) { |
|
| 73 | 73 | $table->engine = 'InnoDB'; |
| 74 | 74 | |
| 75 | 75 | $table->increments('id'); |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | if (!Schema::hasTable(Tag::CROSS_REFERENCE_TABLE_NAME)) { |
| 84 | 84 | Schema::create( |
| 85 | 85 | Tag::CROSS_REFERENCE_TABLE_NAME, |
| 86 | - static function ($table) { |
|
| 86 | + static function($table) { |
|
| 87 | 87 | $table->engine = 'InnoDB'; |
| 88 | 88 | |
| 89 | 89 | $table->integer('tag_id')->unsigned()->nullable()->default(null); |
| 90 | 90 | $table->integer('post_id')->unsigned()->nullable()->default(null); |
| 91 | - $table->index(['tag_id', 'post_id']); |
|
| 91 | + $table->index([ 'tag_id', 'post_id' ]); |
|
| 92 | 92 | $table->foreign('tag_id', 'Tag reference')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade'); |
| 93 | 93 | $table->foreign('post_id', 'Post reference')->references('id')->on('rainlab_blog_posts')->onDelete('cascade'); |
| 94 | 94 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | if (!Schema::hasTable(Series::TABLE_NAME)) { |
| 105 | 105 | Schema::create( |
| 106 | 106 | Series::TABLE_NAME, |
| 107 | - static function ($table) { |
|
| 107 | + static function($table) { |
|
| 108 | 108 | $table->engine = 'InnoDB'; |
| 109 | 109 | |
| 110 | 110 | $table->increments('id'); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - Schema::table('rainlab_blog_posts', function ($table) { |
|
| 118 | + Schema::table('rainlab_blog_posts', function($table) { |
|
| 119 | 119 | $table->integer(Series::TABLE_NAME . '_id')->unsigned()->nullable()->default(null); |
| 120 | 120 | $table->foreign(Series::TABLE_NAME . '_id')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade'); |
| 121 | 121 | }); |
@@ -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']); |
|
| 58 | + $table->index([ 'series_id', 'related_series_id' ]); |
|
| 59 | 59 | $table->foreign('series_id', 'Series reference')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade'); |
| 60 | 60 | $table->foreign('related_series_id', 'Related series reference')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade'); |
| 61 | 61 | } |
@@ -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( |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | private static function separateParameters(array $parameters): array |
| 92 | 92 | { |
| 93 | 93 | $slugs = $parameters; |
| 94 | - $ids = []; |
|
| 94 | + $ids = [ ]; |
|
| 95 | 95 | |
| 96 | 96 | foreach ($slugs as $index => $potentialId) { |
| 97 | 97 | if (is_numeric($potentialId)) { |
| 98 | - $ids[] = $potentialId; |
|
| 99 | - unset($slugs[$index]); |
|
| 98 | + $ids[ ] = $potentialId; |
|
| 99 | + unset($slugs[ $index ]); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - return [$ids, $slugs]; |
|
| 103 | + return [ $ids, $slugs ]; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if (!empty($exceptCategories)) { |
| 113 | 113 | list($ids, $slugs) = self::separateParameters($exceptCategories); |
| 114 | 114 | |
| 115 | - $query->whereDoesntHave('categories', static function (Builder $innerQuery) use ($ids, $slugs) { |
|
| 115 | + $query->whereDoesntHave('categories', static function(Builder $innerQuery) use ($ids, $slugs) { |
|
| 116 | 116 | if (!empty($ids)) { |
| 117 | 117 | $innerQuery->whereIn('id', $ids); |
| 118 | 118 | } |
@@ -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 | * @var integer The current page |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | { |
| 236 | 236 | $this->currentPage = (int)$this->property('page', 1) ?: (int)post('page'); |
| 237 | 237 | $this->resultsPerPage = (int)$this->property('resultsPerPage') |
| 238 | - ?: $this->defineProperties()['resultsPerPage']['default']; |
|
| 238 | + ?: $this->defineProperties()[ 'resultsPerPage' ][ 'default' ]; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
@@ -148,8 +148,8 @@ |
||
| 148 | 148 | { |
| 149 | 149 | $this->seriesPage = $this->getProperty('seriesPage'); |
| 150 | 150 | $this->orderBy = $this->getProperty('orderBy'); |
| 151 | - $this->displayEmpty = (bool) $this->getProperty('displayEmpty'); |
|
| 152 | - $this->fetchPosts = (bool) $this->getProperty('fetchPosts'); |
|
| 151 | + $this->displayEmpty = (bool)$this->getProperty('displayEmpty'); |
|
| 152 | + $this->fetchPosts = (bool)$this->getProperty('fetchPosts'); |
|
| 153 | 153 | $this->limit = $this->getProperty('limit'); |
| 154 | 154 | |
| 155 | 155 | // Exceptions |
@@ -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 |
@@ -270,16 +270,16 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | public function onRun() |
| 272 | 272 | { |
| 273 | - $this->tagPage = (string) $this->getProperty('tagPage'); |
|
| 274 | - $this->tagsPage = (string) $this->getProperty('tagsPage'); |
|
| 273 | + $this->tagPage = (string)$this->getProperty('tagPage'); |
|
| 274 | + $this->tagsPage = (string)$this->getProperty('tagsPage'); |
|
| 275 | 275 | |
| 276 | 276 | $this->orderBy = $this->getProperty('orderBy'); |
| 277 | 277 | $this->postSlug = $this->getProperty('postSlug'); |
| 278 | - $this->fetchPosts = (bool) $this->getProperty('fetchPosts'); |
|
| 279 | - $this->displayEmpty = (bool) $this->getProperty('displayEmpty'); |
|
| 280 | - $this->limit = (int) $this->getProperty('limit'); |
|
| 281 | - $this->exposeTotalCount = (bool) $this->getProperty('exposeTotalCount'); |
|
| 282 | - $this->enableTagFilter = (string) $this->getProperty('enableTagFilter'); |
|
| 278 | + $this->fetchPosts = (bool)$this->getProperty('fetchPosts'); |
|
| 279 | + $this->displayEmpty = (bool)$this->getProperty('displayEmpty'); |
|
| 280 | + $this->limit = (int)$this->getProperty('limit'); |
|
| 281 | + $this->exposeTotalCount = (bool)$this->getProperty('exposeTotalCount'); |
|
| 282 | + $this->enableTagFilter = (string)$this->getProperty('enableTagFilter'); |
|
| 283 | 283 | |
| 284 | 284 | // Exceptions |
| 285 | 285 | $this->populateExceptions(); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | $this->tagsPageUrl = $this->controller->pageUrl($this->tagsPage); |
| 320 | 320 | |
| 321 | - $this->setUrls($tags, $this->tagPage, $this->controller, ['tag' => $this->urlProperty($tagComponent, 'tag')]); |
|
| 321 | + $this->setUrls($tags, $this->tagPage, $this->controller, [ 'tag' => $this->urlProperty($tagComponent, 'tag') ]); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |