@@ -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 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | Schema::create( |
70 | 70 | Tag::TABLE_NAME, |
71 | - function ($table) { |
|
71 | + function($table) { |
|
72 | 72 | $table->engine = 'InnoDB'; |
73 | 73 | |
74 | 74 | $table->increments('id'); |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | |
81 | 81 | Schema::create( |
82 | 82 | Tag::CROSS_REFERENCE_TABLE_NAME, |
83 | - function ($table) { |
|
83 | + function($table) { |
|
84 | 84 | $table->engine = 'InnoDB'; |
85 | 85 | |
86 | 86 | $table->integer('tag_id')->unsigned()->nullable()->default(null); |
87 | 87 | $table->integer('post_id')->unsigned()->nullable()->default(null); |
88 | - $table->index(['tag_id', 'post_id']); |
|
88 | + $table->index([ 'tag_id', 'post_id' ]); |
|
89 | 89 | $table->foreign('tag_id', 'Tag reference')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade'); |
90 | 90 | $table->foreign('post_id', 'Post reference')->references('id')->on('rainlab_blog_posts')->onDelete('cascade'); |
91 | 91 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | Schema::create( |
101 | 101 | Series::TABLE_NAME, |
102 | - function ($table) { |
|
102 | + function($table) { |
|
103 | 103 | $table->engine = 'InnoDB'; |
104 | 104 | |
105 | 105 | $table->increments('id'); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | ); |
112 | 112 | |
113 | - Schema::table('rainlab_blog_posts', function ($table) { |
|
113 | + Schema::table('rainlab_blog_posts', function($table) { |
|
114 | 114 | $table->integer(Series::TABLE_NAME . '_id')->unsigned()->nullable()->default(null); |
115 | 115 | $table->foreign(Series::TABLE_NAME . '_id')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade'); |
116 | 116 | }); |
@@ -10,7 +10,6 @@ |
||
10 | 10 | use Backend\Behaviors\FormController; |
11 | 11 | use Backend\Behaviors\ListController; |
12 | 12 | use October\Rain\Exception\SystemException; |
13 | -use October\Rain\Flash\FlashBag; |
|
14 | 13 | |
15 | 14 | /** |
16 | 15 | * Class Tags |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function onBulkDelete() |
56 | 56 | { |
57 | - if ($checkedIds = (array)post('checked', [])) { |
|
57 | + if ($checkedIds = (array)post('checked', [ ])) { |
|
58 | 58 | $delete = Tag::whereIn('id', $checkedIds)->delete(); |
59 | 59 | } |
60 | 60 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | { |
115 | 115 | $this->asExtension('FormController')->update(post('record_id')); |
116 | 116 | |
117 | - $this->vars['recordId'] = post('record_id'); |
|
117 | + $this->vars[ 'recordId' ] = post('record_id'); |
|
118 | 118 | |
119 | 119 | return $this->makePartial('tag_update_modal_form'); |
120 | 120 | } |
@@ -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', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @var array |
39 | 39 | */ |
40 | - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; |
|
40 | + public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ]; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Translatable properties, indexed property will be available in queries |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @var array |
57 | 57 | */ |
58 | - protected $slugs = ['slug' => 'name']; |
|
58 | + protected $slugs = [ 'slug' => 'name' ]; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Relations |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @var Collection | array |
23 | 23 | */ |
24 | - public $tags = []; |
|
24 | + public $tags = [ ]; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Reference to the page name for linking to tags page |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $this->orderBy = $this->getProperty('orderBy'); |
151 | 151 | $this->postSlug = $this->property('postSlug'); |
152 | 152 | $this->displayEmpty = $this->getProperty('displayEmpty'); |
153 | - $this->limit = $this->getProperty('limit'); |
|
153 | + $this->limit = $this->getProperty('limit'); |
|
154 | 154 | |
155 | 155 | $this->tags = $this->listTags(); |
156 | 156 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | $tagComponent = $this->getComponent(TagPosts::NAME, $this->tagsPage); |
171 | 171 | |
172 | - $this->setUrls($tags, $this->tagsPage, $this->controller, ['tag' => $this->urlProperty($tagComponent, 'tag')]); |
|
172 | + $this->setUrls($tags, $this->tagsPage, $this->controller, [ 'tag' => $this->urlProperty($tagComponent, 'tag') ]); |
|
173 | 173 | |
174 | 174 | return $tags; |
175 | 175 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * @var Collection | array |
25 | 25 | */ |
26 | - public $posts = []; |
|
26 | + public $posts = [ ]; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Reference to the page name for linking to posts |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | |
127 | 127 | private function prepareVars() |
128 | 128 | { |
129 | - $this->orderBy = $this->page['orderBy'] = $this->property('orderBy'); |
|
129 | + $this->orderBy = $this->page[ 'orderBy' ] = $this->property('orderBy'); |
|
130 | 130 | |
131 | 131 | // Page links |
132 | - $this->postPage = $this->page['postPage' ] = $this->property('postPage'); |
|
132 | + $this->postPage = $this->page[ 'postPage' ] = $this->property('postPage'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | public function getPostPageOptions() |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | $query = Post::isPublished() |
166 | 166 | ->where('id', '<>', $post->id) |
167 | - ->whereHas('tags', function ($tag) use ($tagIds) { |
|
167 | + ->whereHas('tags', function($tag) use ($tagIds) { |
|
168 | 168 | $tag->whereIn('id', $tagIds); |
169 | 169 | }) |
170 | 170 | ->with('tags'); |
@@ -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 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public function registerNavigation() |
94 | 94 | { |
95 | 95 | // Extend the navigation |
96 | - Event::listen('backend.menu.extendItems', function ($manager) { |
|
96 | + Event::listen('backend.menu.extendItems', function($manager) { |
|
97 | 97 | $manager->addSideMenuItems(self::REQUIRED_PLUGIN_RAINLAB_BLOG, 'blog', [ |
98 | 98 | 'series' => [ |
99 | 99 | 'label' => self::LOCALIZATION_KEY . 'navigation.series', |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | */ |
120 | 120 | private function extendModel() |
121 | 121 | { |
122 | - PostModel::extend(function ($model) { |
|
123 | - $model->belongsToMany['tags'] = [ |
|
122 | + PostModel::extend(function($model) { |
|
123 | + $model->belongsToMany[ 'tags' ] = [ |
|
124 | 124 | Tag::class, |
125 | 125 | 'table' => Tag::CROSS_REFERENCE_TABLE_NAME, |
126 | 126 | 'order' => 'name' |
127 | 127 | ]; |
128 | 128 | |
129 | - $model->belongsTo['series'] = [ |
|
129 | + $model->belongsTo[ 'series' ] = [ |
|
130 | 130 | Series::class, |
131 | 131 | 'key' => Series::TABLE_NAME . "_id" |
132 | 132 | ]; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | private function extendPostsController() |
140 | 140 | { |
141 | - PostsController::extendFormFields(function ($form, $model) { |
|
141 | + PostsController::extendFormFields(function($form, $model) { |
|
142 | 142 | if (!$model instanceof PostModel) { |
143 | 143 | return; |
144 | 144 | } |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | $tab = self::LOCALIZATION_KEY . 'navigation.taxonomy'; |
158 | 158 | |
159 | 159 | $categoriesConfig = $form->getField('categories')->config; |
160 | - $categoriesConfig['tab'] = $tab; |
|
161 | - $categoriesConfig['mode'] = 'relation'; |
|
162 | - $categoriesConfig['type'] = 'taglist'; |
|
163 | - $categoriesConfig['label'] = 'rainlab.blog::lang.post.tab_categories'; |
|
164 | - $categoriesConfig['comment'] = "rainlab.blog::lang.post.categories_comment"; |
|
165 | - $categoriesConfig['placeholder'] = self::LOCALIZATION_KEY . 'placeholders.categories'; |
|
166 | - unset($categoriesConfig['commentAbove']); |
|
160 | + $categoriesConfig[ 'tab' ] = $tab; |
|
161 | + $categoriesConfig[ 'mode' ] = 'relation'; |
|
162 | + $categoriesConfig[ 'type' ] = 'taglist'; |
|
163 | + $categoriesConfig[ 'label' ] = 'rainlab.blog::lang.post.tab_categories'; |
|
164 | + $categoriesConfig[ 'comment' ] = "rainlab.blog::lang.post.categories_comment"; |
|
165 | + $categoriesConfig[ 'placeholder' ] = self::LOCALIZATION_KEY . 'placeholders.categories'; |
|
166 | + unset($categoriesConfig[ 'commentAbove' ]); |
|
167 | 167 | |
168 | 168 | $form->removeField('categories'); |
169 | 169 | |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | */ |
195 | 195 | private function extendCategoriesController() |
196 | 196 | { |
197 | - CategoriesController::extend(function (Controller $controller) { |
|
198 | - $controller->implement[] = RelationController::class; |
|
197 | + CategoriesController::extend(function(Controller $controller) { |
|
198 | + $controller->implement[ ] = RelationController::class; |
|
199 | 199 | $relationConfig = '$/' . self::DIRECTORY_KEY . '/controllers/category/config_relation.yaml'; |
200 | 200 | |
201 | 201 | if (property_exists($controller, 'relationConfig')) { |
@@ -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, function ($table) { |
|
22 | + Schema::table(Series::TABLE_NAME, 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, function ($table) { |
|
34 | + Schema::table(Series::TABLE_NAME, function($table) { |
|
35 | 35 | $table->string('description')->nullable()->change(); |
36 | 36 | }); |
37 | 37 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | */ |
67 | 67 | protected function getPostsQuery() |
68 | 68 | { |
69 | - $query = Post::whereHas('tags', function ($query) { |
|
69 | + $query = Post::whereHas('tags', function($query) { |
|
70 | 70 | $query->whereTranslatable('slug', $this->tag->slug); |
71 | 71 | })->isPublished(); |
72 | 72 |