@@ -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 | } |
@@ -87,13 +87,13 @@ |
||
87 | 87 | */ |
88 | 88 | protected function getPostsQuery() |
89 | 89 | { |
90 | - $query = Post::whereHas('tags', function ($query) { |
|
90 | + $query = Post::whereHas('tags', function($query) { |
|
91 | 91 | $query->whereTranslatable('slug', $this->tag->slug); |
92 | 92 | }); |
93 | 93 | |
94 | 94 | if ($this->includeSeriesPosts) { |
95 | - $query->orWhereHas('series', function ($query) { |
|
96 | - $query->whereHas('tags', function ($query) { |
|
95 | + $query->orWhereHas('series', function($query) { |
|
96 | + $query->whereHas('tags', function($query) { |
|
97 | 97 | $query->whereTranslatable('slug', $this->tag->slug); |
98 | 98 | }); |
99 | 99 | }); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function onBulkDelete() |
57 | 57 | { |
58 | - if ($checkedIds = (array)post('checked', [])) { |
|
58 | + if ($checkedIds = (array)post('checked', [ ])) { |
|
59 | 59 | $delete = Tag::whereIn('id', $checkedIds)->delete(); |
60 | 60 | } |
61 | 61 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function index_onRemoveOrphanedTags() |
79 | 79 | { |
80 | - if (!Tag::has('posts', 0)->has('series', 0)->count() ) { |
|
80 | + if (!Tag::has('posts', 0)->has('series', 0)->count()) { |
|
81 | 81 | Flash::warning(e(trans(Plugin::LOCALIZATION_KEY . 'form.tags.no_orphaned_tags'))); |
82 | 82 | |
83 | 83 | return; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $tag = Tag::whereId($recordId)->first(); |
109 | 109 | |
110 | 110 | if ($tag !== null) { |
111 | - $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.tags.edit_title', ['tag' => $tag->name]); |
|
111 | + $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.tags.edit_title', [ 'tag' => $tag->name ]); |
|
112 | 112 | } else { |
113 | 113 | $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.tags.tag_does_not_exist'); |
114 | 114 | } |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $series = SeriesModel::whereId($recordId)->first(); |
57 | 57 | |
58 | 58 | if ($series !== null) { |
59 | - $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.edit_title', ['series' => $series->title]); |
|
59 | + $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.edit_title', [ 'series' => $series->title ]); |
|
60 | 60 | } else { |
61 | 61 | $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.series_does_not_exist'); |
62 | 62 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function registerNavigation() |
105 | 105 | { |
106 | 106 | // Extend the navigation |
107 | - Event::listen('backend.menu.extendItems', function ($manager) { |
|
107 | + Event::listen('backend.menu.extendItems', function($manager) { |
|
108 | 108 | $manager->addSideMenuItems(self::REQUIRED_PLUGIN_RAINLAB_BLOG, 'blog', [ |
109 | 109 | 'series' => [ |
110 | 110 | 'label' => self::LOCALIZATION_KEY . 'navigation.series', |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | */ |
131 | 131 | private function extendModel() |
132 | 132 | { |
133 | - PostModel::extend(function ($model) { |
|
133 | + PostModel::extend(function($model) { |
|
134 | 134 | $model->morphToMany = [ |
135 | - 'tags' => [Tag::class, 'name' => Tag::PIVOT_COLUMN] |
|
135 | + 'tags' => [ Tag::class, 'name' => Tag::PIVOT_COLUMN ] |
|
136 | 136 | ]; |
137 | 137 | |
138 | - $model->belongsTo['series'] = [ |
|
138 | + $model->belongsTo[ 'series' ] = [ |
|
139 | 139 | Series::class, |
140 | 140 | 'key' => Series::TABLE_NAME . "_id" |
141 | 141 | ]; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | private function extendPostsController() |
149 | 149 | { |
150 | - PostsController::extendFormFields(function ($form, $model) { |
|
150 | + PostsController::extendFormFields(function($form, $model) { |
|
151 | 151 | if (!$model instanceof PostModel) { |
152 | 152 | return; |
153 | 153 | } |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | $tab = self::LOCALIZATION_KEY . 'navigation.taxonomy'; |
167 | 167 | |
168 | 168 | $categoriesConfig = $form->getField('categories')->config; |
169 | - $categoriesConfig['tab'] = $tab; |
|
170 | - $categoriesConfig['mode'] = 'relation'; |
|
171 | - $categoriesConfig['type'] = 'taglist'; |
|
172 | - $categoriesConfig['label'] = 'rainlab.blog::lang.post.tab_categories'; |
|
173 | - $categoriesConfig['comment'] = "rainlab.blog::lang.post.categories_comment"; |
|
174 | - $categoriesConfig['placeholder'] = self::LOCALIZATION_KEY . 'placeholders.categories'; |
|
175 | - unset($categoriesConfig['commentAbove']); |
|
169 | + $categoriesConfig[ 'tab' ] = $tab; |
|
170 | + $categoriesConfig[ 'mode' ] = 'relation'; |
|
171 | + $categoriesConfig[ 'type' ] = 'taglist'; |
|
172 | + $categoriesConfig[ 'label' ] = 'rainlab.blog::lang.post.tab_categories'; |
|
173 | + $categoriesConfig[ 'comment' ] = "rainlab.blog::lang.post.categories_comment"; |
|
174 | + $categoriesConfig[ 'placeholder' ] = self::LOCALIZATION_KEY . 'placeholders.categories'; |
|
175 | + unset($categoriesConfig[ 'commentAbove' ]); |
|
176 | 176 | |
177 | 177 | $form->removeField('categories'); |
178 | 178 | |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | */ |
207 | 207 | private function extendCategoriesController() |
208 | 208 | { |
209 | - CategoriesController::extend(function (Controller $controller) { |
|
210 | - $controller->implement[] = RelationController::class; |
|
209 | + CategoriesController::extend(function(Controller $controller) { |
|
210 | + $controller->implement[ ] = RelationController::class; |
|
211 | 211 | $relationConfig = '$/' . self::DIRECTORY_KEY . '/controllers/category/config_relation.yaml'; |
212 | 212 | |
213 | 213 | if (property_exists($controller, 'relationConfig')) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | Schema::create( |
57 | 57 | Tag::PIVOT_TABLE, |
58 | - static function ($table) use ($pivotColumnId, $pivotColumnType) { |
|
58 | + static function($table) use ($pivotColumnId, $pivotColumnType) { |
|
59 | 59 | $table->engine = 'InnoDB'; |
60 | 60 | |
61 | 61 | $table->integer('tag_id')->unsigned()->nullable()->default(null); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $table->string($pivotColumnType); |
64 | 64 | |
65 | 65 | $table->index( |
66 | - ['tag_id', Tag::PIVOT_COLUMN . '_id', Tag::PIVOT_COLUMN . '_type'], |
|
66 | + [ 'tag_id', Tag::PIVOT_COLUMN . '_id', Tag::PIVOT_COLUMN . '_type' ], |
|
67 | 67 | 'ginopane_blogtaxonomy_taggable_index' |
68 | 68 | ); |
69 | 69 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * @var array |
22 | 22 | */ |
23 | - public static $sortingOptions = []; |
|
23 | + public static $sortingOptions = [ ]; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Sets the URL attribute with a URL to this object |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return mixed |
55 | 55 | */ |
56 | - public function scopeListFrontend(Builder $query, array $options = []) |
|
56 | + public function scopeListFrontend(Builder $query, array $options = [ ]) |
|
57 | 57 | { |
58 | 58 | $this->withRelation($query, $options); |
59 | 59 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function queryDisplayEmpty(Builder $query, array $options) |
105 | 105 | { |
106 | - if (empty($options['displayEmpty'])) { |
|
106 | + if (empty($options[ 'displayEmpty' ])) { |
|
107 | 107 | $query |
108 | 108 | ->having('posts_count', '>', 0); |
109 | 109 | } |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function queryPostSlug(Builder $query, array $options) |
119 | 119 | { |
120 | - if (!empty($options['post'])) { |
|
120 | + if (!empty($options[ 'post' ])) { |
|
121 | 121 | $query->whereHas( |
122 | 122 | 'posts', |
123 | - static function ($query) use ($options) { |
|
124 | - ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']); |
|
123 | + static function($query) use ($options) { |
|
124 | + ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]); |
|
125 | 125 | } |
126 | 126 | ); |
127 | 127 | } |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | */ |
136 | 136 | private function queryLimit(Builder $query, array $options) |
137 | 137 | { |
138 | - if (!empty($options['limit'])) { |
|
139 | - $query->take($options['limit']); |
|
138 | + if (!empty($options[ 'limit' ])) { |
|
139 | + $query->take($options[ 'limit' ]); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | */ |
149 | 149 | private function queryOrderBy(Builder $query, array $options) |
150 | 150 | { |
151 | - if (!empty($options['sort']) && \array_key_exists($options['sort'], static::$sortingOptions)) { |
|
152 | - if ($options['sort'] === 'random') { |
|
151 | + if (!empty($options[ 'sort' ]) && \array_key_exists($options[ 'sort' ], static::$sortingOptions)) { |
|
152 | + if ($options[ 'sort' ] === 'random') { |
|
153 | 153 | $query->inRandomOrder(); |
154 | 154 | } else { |
155 | - list($sortField, $sortDirection) = explode(' ', $options['sort']); |
|
155 | + list($sortField, $sortDirection) = explode(' ', $options[ 'sort' ]); |
|
156 | 156 | |
157 | 157 | $query->orderBy($sortField, $sortDirection); |
158 | 158 | } |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | */ |
168 | 168 | protected function withRelation(Builder $query, array $options) |
169 | 169 | { |
170 | - if (!empty($options['fetchPosts'])) { |
|
170 | + if (!empty($options[ 'fetchPosts' ])) { |
|
171 | 171 | $query->with( |
172 | 172 | [ |
173 | - 'posts' => static function (HasMany $query) use ($options) { |
|
173 | + 'posts' => static function(HasMany $query) use ($options) { |
|
174 | 174 | $query->isPublished(); |
175 | 175 | |
176 | 176 | self::handleExceptions($query->getQuery(), $options); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | $query->withCount( |
183 | 183 | [ |
184 | - 'posts' => static function ($query) use ($options) { |
|
184 | + 'posts' => static function($query) use ($options) { |
|
185 | 185 | $query->isPublished(); |
186 | 186 | |
187 | 187 | self::handleExceptions($query, $options); |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | */ |
205 | 205 | protected static function handleExceptions(Builder $query, array $options) |
206 | 206 | { |
207 | - if (!empty($options['exceptPosts'])) { |
|
208 | - PostListExceptionsTrait::handleExceptionsByPost($query, $options['exceptPosts']); |
|
207 | + if (!empty($options[ 'exceptPosts' ])) { |
|
208 | + PostListExceptionsTrait::handleExceptionsByPost($query, $options[ 'exceptPosts' ]); |
|
209 | 209 | } |
210 | 210 | |
211 | - if (!empty($options['exceptCategories'])) { |
|
212 | - PostListExceptionsTrait::handleExceptionsByCategory($query, $options['exceptCategories']); |
|
211 | + if (!empty($options[ 'exceptCategories' ])) { |
|
212 | + PostListExceptionsTrait::handleExceptionsByCategory($query, $options[ 'exceptCategories' ]); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function up() |
20 | 20 | { |
21 | 21 | if (Schema::hasTable(Series::TABLE_NAME)) { |
22 | - Schema::table(Series::TABLE_NAME, static function ($table) { |
|
22 | + Schema::table(Series::TABLE_NAME, static function($table) { |
|
23 | 23 | $table->text('description')->nullable()->change(); |
24 | 24 | }); |
25 | 25 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function down() |
32 | 32 | { |
33 | 33 | if (Schema::hasTable(Series::TABLE_NAME)) { |
34 | - Schema::table(Series::TABLE_NAME, static function ($table) { |
|
34 | + Schema::table(Series::TABLE_NAME, static function($table) { |
|
35 | 35 | $table->string('description')->nullable()->change(); |
36 | 36 | }); |
37 | 37 | } |