@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | private static function separateParameters(array $parameters): array |
109 | 109 | { |
110 | 110 | $slugs = $parameters; |
111 | - $ids = []; |
|
111 | + $ids = [ ]; |
|
112 | 112 | |
113 | 113 | foreach ($slugs as $index => $potentialId) { |
114 | 114 | if (is_numeric($potentialId)) { |
115 | - $ids[] = $potentialId; |
|
116 | - unset($slugs[$index]); |
|
115 | + $ids[ ] = $potentialId; |
|
116 | + unset($slugs[ $index ]); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - return [$ids, $slugs]; |
|
120 | + return [ $ids, $slugs ]; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | if (!empty($exceptCategories)) { |
130 | 130 | list($ids, $slugs) = self::separateParameters($exceptCategories); |
131 | 131 | |
132 | - $query->whereDoesntHave('categories', static function (Builder $innerQuery) use ($ids, $slugs) { |
|
132 | + $query->whereDoesntHave('categories', static function(Builder $innerQuery) use ($ids, $slugs) { |
|
133 | 133 | if (!empty($ids)) { |
134 | 134 | $innerQuery->whereIn('id', $ids); |
135 | 135 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | if (!empty($includeCategories)) { |
151 | 151 | list($ids, $slugs) = self::separateParameters($includeCategories); |
152 | 152 | |
153 | - $query->whereHas('categories', static function (Builder $innerQuery) use ($ids, $slugs) { |
|
153 | + $query->whereHas('categories', static function(Builder $innerQuery) use ($ids, $slugs) { |
|
154 | 154 | if (!empty($ids)) { |
155 | 155 | $innerQuery->whereIn('id', $ids); |
156 | 156 | } |
@@ -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->string('status')->default(Series::STATUS_ACTIVE); |
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->dropColumn('status'); |
36 | 36 | }); |
37 | 37 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $series = SeriesModel::whereId($recordId)->first(); |
58 | 58 | |
59 | 59 | if ($series !== null) { |
60 | - $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.edit_title', ['series' => $series->title]); |
|
60 | + $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.edit_title', [ 'series' => $series->title ]); |
|
61 | 61 | } else { |
62 | 62 | $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.series_does_not_exist'); |
63 | 63 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function onBulkDelete() |
74 | 74 | { |
75 | - if ($checkedIds = (array)post('checked', [])) { |
|
75 | + if ($checkedIds = (array)post('checked', [ ])) { |
|
76 | 76 | $delete = SeriesModel::whereIn('id', $checkedIds)->delete(); |
77 | 77 | } |
78 | 78 |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | { |
61 | 61 | // Add a "url" helper attribute for linking to each post and category |
62 | 62 | if (!empty($this->postPage) && $posts && $posts->count()) { |
63 | - $posts->each(function ($post) { |
|
63 | + $posts->each(function($post) { |
|
64 | 64 | $this->setPostUrl($post); |
65 | 65 | |
66 | 66 | if (!empty($this->categoryPage) && $post->categories->count()) { |
67 | - $post->categories->each(function ($category) { |
|
67 | + $post->categories->each(function($category) { |
|
68 | 68 | /** @var Category $category */ |
69 | 69 | $category->setUrl( |
70 | 70 | $this->categoryPage, |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | if ($component !== null && ($property = $component->property($name))) { |
102 | 102 | preg_match('/{{ :([^ ]+) }}/', $property, $matches); |
103 | 103 | |
104 | - if (isset($matches[1])) { |
|
105 | - $property = $matches[1]; |
|
104 | + if (isset($matches[ 1 ])) { |
|
105 | + $property = $matches[ 1 ]; |
|
106 | 106 | } |
107 | 107 | } else { |
108 | 108 | $property = $name; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getProperty(string $property, $default = null) |
124 | 124 | { |
125 | - return $this->property($property, $this->defineProperties()[$property]['default'] ?? $default); |
|
125 | + return $this->property($property, $this->defineProperties()[ $property ][ 'default' ] ?? $default); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * @var Collection | array |
31 | 31 | */ |
32 | - public $posts = []; |
|
32 | + public $posts = [ ]; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Reference to the page name for linking to posts |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | |
133 | 133 | private function prepareVars() |
134 | 134 | { |
135 | - $this->orderBy = $this->page['orderBy'] = $this->property('orderBy'); |
|
135 | + $this->orderBy = $this->page[ 'orderBy' ] = $this->property('orderBy'); |
|
136 | 136 | |
137 | 137 | // Page links |
138 | - $this->postPage = $this->page['postPage' ] = $this->property('postPage'); |
|
138 | + $this->postPage = $this->page[ 'postPage' ] = $this->property('postPage'); |
|
139 | 139 | |
140 | 140 | // Exceptions |
141 | 141 | $this->populateFilters(); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | $query = Post::isPublished() |
178 | 178 | ->where('id', '<>', $post->id) |
179 | - ->whereHas('tags', function ($tag) use ($tagIds) { |
|
179 | + ->whereHas('tags', function($tag) use ($tagIds) { |
|
180 | 180 | $tag->whereIn('id', $tagIds); |
181 | 181 | }) |
182 | 182 | ->with('tags'); |
@@ -88,14 +88,14 @@ |
||
88 | 88 | */ |
89 | 89 | protected function getPostsQuery() |
90 | 90 | { |
91 | - $query = Post::whereHas('series', function ($query) { |
|
91 | + $query = Post::whereHas('series', function($query) { |
|
92 | 92 | $query->whereTranslatable('slug', $this->series->slug); |
93 | 93 | }); |
94 | 94 | |
95 | 95 | $tagIds = $this->series->tags->lists('id'); |
96 | 96 | |
97 | 97 | if (!empty($tagIds) && $this->includeTaggedPosts) { |
98 | - $query->orWhereHas('tags', function ($tag) use ($tagIds) { |
|
98 | + $query->orWhereHas('tags', function($tag) use ($tagIds) { |
|
99 | 99 | $tag->whereIn('id', $tagIds); |
100 | 100 | }); |
101 | 101 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $postType = PostType::whereId($recordId)->first(); |
58 | 58 | |
59 | 59 | if ($postType !== null) { |
60 | - $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.post_types.edit_title', ['post_type' => $postType->name]); |
|
60 | + $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.post_types.edit_title', [ 'post_type' => $postType->name ]); |
|
61 | 61 | } else { |
62 | 62 | $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.post_types.post_type_does_not_exist'); |
63 | 63 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function onBulkDelete() |
74 | 74 | { |
75 | - if ($checkedIds = (array)post('checked', [])) { |
|
75 | + if ($checkedIds = (array)post('checked', [ ])) { |
|
76 | 76 | $delete = PostType::whereIn('id', $checkedIds)->delete(); |
77 | 77 | } |
78 | 78 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | protected function prepareContextItem() |
78 | 78 | { |
79 | 79 | // load tag |
80 | - $this->tag = $this->page['tag'] = Tag::whereTranslatable('slug', $this->property('tag'))->first(); |
|
80 | + $this->tag = $this->page[ 'tag' ] = Tag::whereTranslatable('slug', $this->property('tag'))->first(); |
|
81 | 81 | |
82 | 82 | return $this->tag; |
83 | 83 | } |
@@ -87,13 +87,13 @@ discard block |
||
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 | }); |
@@ -29,12 +29,12 @@ |
||
29 | 29 | if (!Schema::hasTable('ginopane_blogtaxonomy_post_tag')) { |
30 | 30 | Schema::create( |
31 | 31 | 'ginopane_blogtaxonomy_post_tag', |
32 | - static function ($table) { |
|
32 | + static function($table) { |
|
33 | 33 | $table->engine = 'InnoDB'; |
34 | 34 | |
35 | 35 | $table->integer('tag_id')->unsigned()->nullable()->default(null); |
36 | 36 | $table->integer('post_id')->unsigned()->nullable()->default(null); |
37 | - $table->index(['tag_id', 'post_id']); |
|
37 | + $table->index([ 'tag_id', 'post_id' ]); |
|
38 | 38 | $table->foreign('tag_id')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade'); |
39 | 39 | $table->foreign('post_id')->references('id')->on('rainlab_blog_posts')->onDelete('cascade'); |
40 | 40 | } |