@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | */ |
54 | 54 | private function dropSeries() |
55 | 55 | { |
56 | - Schema::table('rainlab_blog_posts', static function ($table) { |
|
57 | - $table->dropForeign([Series::TABLE_NAME . '_id']); |
|
56 | + Schema::table('rainlab_blog_posts', static function($table) { |
|
57 | + $table->dropForeign([ Series::TABLE_NAME . '_id' ]); |
|
58 | 58 | }); |
59 | 59 | |
60 | 60 | if (Schema::hasColumn('rainlab_blog_posts', Series::TABLE_NAME . '_id')) { |
61 | - Schema::table('rainlab_blog_posts', static function ($table) { |
|
61 | + Schema::table('rainlab_blog_posts', static function($table) { |
|
62 | 62 | $table->dropColumn(Series::TABLE_NAME . '_id'); |
63 | 63 | }); |
64 | 64 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | if (!Schema::hasTable(Tag::TABLE_NAME)) { |
75 | 75 | Schema::create( |
76 | 76 | Tag::TABLE_NAME, |
77 | - static function ($table) { |
|
77 | + static function($table) { |
|
78 | 78 | $table->engine = 'InnoDB'; |
79 | 79 | |
80 | 80 | $table->increments('id'); |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | if (!Schema::hasTable(Tag::CROSS_REFERENCE_TABLE_NAME)) { |
89 | 89 | Schema::create( |
90 | 90 | Tag::CROSS_REFERENCE_TABLE_NAME, |
91 | - static function ($table) { |
|
91 | + static function($table) { |
|
92 | 92 | $table->engine = 'InnoDB'; |
93 | 93 | |
94 | 94 | $table->integer('tag_id')->unsigned()->nullable()->default(null); |
95 | 95 | $table->integer('post_id')->unsigned()->nullable()->default(null); |
96 | - $table->index(['tag_id', 'post_id']); |
|
96 | + $table->index([ 'tag_id', 'post_id' ]); |
|
97 | 97 | $table->foreign('tag_id')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade'); |
98 | 98 | $table->foreign('post_id')->references('id')->on('rainlab_blog_posts')->onDelete('cascade'); |
99 | 99 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | if (!Schema::hasTable(Series::TABLE_NAME)) { |
110 | 110 | Schema::create( |
111 | 111 | Series::TABLE_NAME, |
112 | - static function ($table) { |
|
112 | + static function($table) { |
|
113 | 113 | $table->engine = 'InnoDB'; |
114 | 114 | |
115 | 115 | $table->increments('id'); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | ); |
122 | 122 | |
123 | - Schema::table('rainlab_blog_posts', function ($table) { |
|
123 | + Schema::table('rainlab_blog_posts', function($table) { |
|
124 | 124 | $table->integer(Series::TABLE_NAME . '_id')->unsigned()->nullable()->default(null); |
125 | 125 | $table->foreign(Series::TABLE_NAME . '_id')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade'); |
126 | 126 | }); |
@@ -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 | } |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private function dropPostTypes() |
78 | 78 | { |
79 | - Schema::table('rainlab_blog_posts', static function ($table) { |
|
80 | - $table->dropForeign([PostType::TABLE_NAME . '_id']); |
|
79 | + Schema::table('rainlab_blog_posts', static function($table) { |
|
80 | + $table->dropForeign([ PostType::TABLE_NAME . '_id' ]); |
|
81 | 81 | |
82 | - $table->dropColumn(PostType::TABLE_NAME. '_attributes'); |
|
82 | + $table->dropColumn(PostType::TABLE_NAME . '_attributes'); |
|
83 | 83 | }); |
84 | 84 | |
85 | 85 | if (Schema::hasColumn('rainlab_blog_posts', PostType::TABLE_NAME . '_id')) { |
86 | - Schema::table('rainlab_blog_posts', static function ($table) { |
|
86 | + Schema::table('rainlab_blog_posts', static function($table) { |
|
87 | 87 | $table->dropColumn(PostType::TABLE_NAME . '_id'); |
88 | 88 | }); |
89 | 89 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if (!Schema::hasTable(PostType::TABLE_NAME)) { |
100 | 100 | Schema::create( |
101 | 101 | PostType::TABLE_NAME, |
102 | - static function ($table) { |
|
102 | + static function($table) { |
|
103 | 103 | $table->engine = 'InnoDB'; |
104 | 104 | |
105 | 105 | $table->increments('id'); |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | } |
112 | 112 | ); |
113 | 113 | |
114 | - Schema::table('rainlab_blog_posts', function ($table) { |
|
114 | + Schema::table('rainlab_blog_posts', function($table) { |
|
115 | 115 | $table->integer(PostType::TABLE_NAME . '_id')->unsigned()->nullable()->default(null); |
116 | 116 | $table->foreign(PostType::TABLE_NAME . '_id')->references('id')->on(PostType::TABLE_NAME)->onDelete('cascade'); |
117 | 117 | |
118 | - $table->json(PostType::TABLE_NAME. '_attributes')->nullable(); |
|
118 | + $table->json(PostType::TABLE_NAME . '_attributes')->nullable(); |
|
119 | 119 | }); |
120 | 120 | |
121 | 121 | DB::table(PostType::TABLE_NAME)->insert( |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | const POST_CATEGORIES_COVER_IMAGES_ENABLED_KEY = 'post_categories_cover_image_enabled'; |
19 | 19 | const POST_CATEGORIES_FEATURED_IMAGES_ENABLED_KEY = 'post_categories_featured_images_enabled'; |
20 | 20 | |
21 | - public $implement = [SettingsModel::class]; |
|
21 | + public $implement = [ SettingsModel::class ]; |
|
22 | 22 | |
23 | 23 | public $settingsCode = self::SETTINGS_CODE; |
24 | 24 | |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | |
27 | 27 | public function postTypesEnabled() : bool |
28 | 28 | { |
29 | - return (bool) $this->{self::POST_TYPES_ENABLED_KEY}; |
|
29 | + return (bool)$this->{self::POST_TYPES_ENABLED_KEY}; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function postCategoriesCoverImageEnabled() : bool |
33 | 33 | { |
34 | - return (bool) $this->{self::POST_CATEGORIES_COVER_IMAGES_ENABLED_KEY}; |
|
34 | + return (bool)$this->{self::POST_CATEGORIES_COVER_IMAGES_ENABLED_KEY}; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function postCategoriesFeaturedImagesEnabled() : bool |
38 | 38 | { |
39 | - return (bool) $this->{self::POST_CATEGORIES_FEATURED_IMAGES_ENABLED_KEY}; |
|
39 | + return (bool)$this->{self::POST_CATEGORIES_FEATURED_IMAGES_ENABLED_KEY}; |
|
40 | 40 | } |
41 | 41 | } |
@@ -41,12 +41,12 @@ 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 | * @var array Attributes to be stored as JSON |
48 | 48 | */ |
49 | - protected $jsonable = ['type_attributes']; |
|
49 | + protected $jsonable = [ 'type_attributes' ]; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Translatable properties, indexed property will be available in queries |
@@ -103,5 +103,5 @@ discard block |
||
103 | 103 | 'type_attributes.*.name.unique_in_repeater' => Plugin::LOCALIZATION_KEY . 'form.post_types.type_attributes_name_unique', |
104 | 104 | ]; |
105 | 105 | |
106 | - protected $slugs = ['slug' => 'name']; |
|
106 | + protected $slugs = [ 'slug' => 'name' ]; |
|
107 | 107 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @var array |
46 | 46 | */ |
47 | - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; |
|
47 | + public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ]; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Translatable properties, indexed property will be available in queries |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * @var array |
64 | 64 | */ |
65 | - protected $slugs = ['slug' => 'name']; |
|
65 | + protected $slugs = [ 'slug' => 'name' ]; |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Relations |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @var array |
71 | 71 | */ |
72 | 72 | public $morphedByMany = [ |
73 | - 'posts' => [Post::class, 'name' => Tag::PIVOT_COLUMN], |
|
74 | - 'series' => [Series::class, 'name' => Tag::PIVOT_COLUMN], |
|
73 | + 'posts' => [ Post::class, 'name' => Tag::PIVOT_COLUMN ], |
|
74 | + 'series' => [ Series::class, 'name' => Tag::PIVOT_COLUMN ], |
|
75 | 75 | ]; |
76 | 76 | |
77 | 77 | /** |
@@ -195,12 +195,12 @@ discard block |
||
195 | 195 | { |
196 | 196 | parent::queryPostSlug($query, $options); |
197 | 197 | |
198 | - if (!empty($options['post']) && !empty($options['includeSeriesTags'])) { |
|
199 | - $query->orWhereHas('series', static function ($query) use ($options) { |
|
198 | + if (!empty($options[ 'post' ]) && !empty($options[ 'includeSeriesTags' ])) { |
|
199 | + $query->orWhereHas('series', static function($query) use ($options) { |
|
200 | 200 | $query->whereHas( |
201 | 201 | 'posts', |
202 | - static function ($query) use ($options) { |
|
203 | - ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']); |
|
202 | + static function($query) use ($options) { |
|
203 | + ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]); |
|
204 | 204 | } |
205 | 205 | ); |
206 | 206 | }); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | protected function queryDisplayEmpty(Builder $query, array $options) |
217 | 217 | { |
218 | - if (empty($options['displayEmpty'])) { |
|
218 | + if (empty($options[ 'displayEmpty' ])) { |
|
219 | 219 | $query |
220 | 220 | ->having('posts_count', '>', 0) |
221 | 221 | ->orHaving('series_count', '>', 0); |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | */ |
231 | 231 | private function postRelation(Builder $query, array $options) |
232 | 232 | { |
233 | - if (!empty($options['fetchPosts'])) { |
|
233 | + if (!empty($options[ 'fetchPosts' ])) { |
|
234 | 234 | $query->with( |
235 | 235 | [ |
236 | - 'posts' => static function (MorphToMany $query) use ($options) { |
|
236 | + 'posts' => static function(MorphToMany $query) use ($options) { |
|
237 | 237 | $query->isPublished(); |
238 | 238 | |
239 | 239 | self::handleExceptions($query->getQuery(), $options); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | $query->withCount( |
246 | 246 | [ |
247 | - 'posts' => static function ($query) use ($options) { |
|
247 | + 'posts' => static function($query) use ($options) { |
|
248 | 248 | $query->isPublished(); |
249 | 249 | |
250 | 250 | self::handleExceptions($query, $options); |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | { |
264 | 264 | $query->withCount('series'); |
265 | 265 | |
266 | - if (!empty($options['fetchSeriesPostCount'])) { |
|
266 | + if (!empty($options[ 'fetchSeriesPostCount' ])) { |
|
267 | 267 | $query->with( |
268 | 268 | [ |
269 | - 'series' => static function (MorphToMany $query) use ($options) { |
|
269 | + 'series' => static function(MorphToMany $query) use ($options) { |
|
270 | 270 | $query->withCount( |
271 | 271 | [ |
272 | - 'posts' => static function ($query) use ($options) { |
|
272 | + 'posts' => static function($query) use ($options) { |
|
273 | 273 | $query->isPublished(); |
274 | 274 | |
275 | 275 | self::handleExceptions($query, $options); |