@@ -18,9 +18,9 @@ |
||
18 | 18 | |
19 | 19 | public function prepareVars() |
20 | 20 | { |
21 | - $this->vars['name'] = $this->formField->getName(); |
|
22 | - $this->vars['value'] = $this->getLoadValue(); |
|
23 | - $this->vars['model'] = $this->model; |
|
21 | + $this->vars[ 'name' ] = $this->formField->getName(); |
|
22 | + $this->vars[ 'value' ] = $this->getLoadValue(); |
|
23 | + $this->vars[ 'model' ] = $this->model; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function loadAssets() |
@@ -17,18 +17,18 @@ |
||
17 | 17 | 'label' => 'Reviews', |
18 | 18 | 'url' => Backend::url('vojtasvoboda/reviews/reviews'), |
19 | 19 | 'icon' => 'icon-star-half-o', |
20 | - 'permissions' => ['vojtasvoboda.reviews.*'], |
|
20 | + 'permissions' => [ 'vojtasvoboda.reviews.*' ], |
|
21 | 21 | 'order' => 510, |
22 | 22 | 'sideMenu' => [ |
23 | 23 | 'reviews' => [ |
24 | 24 | 'label' => 'Reviews', |
25 | 25 | 'url' => Backend::url('vojtasvoboda/reviews/reviews'), |
26 | 26 | 'icon' => 'icon-star-half-o', |
27 | - 'permissions' => ['vojtasvoboda.reviews.reviews'], |
|
27 | + 'permissions' => [ 'vojtasvoboda.reviews.reviews' ], |
|
28 | 28 | 'order' => 100, |
29 | 29 | ], |
30 | 30 | 'categories' => [ |
31 | - 'permissions' => ['vojtasvoboda.reviews.categories'], |
|
31 | + 'permissions' => [ 'vojtasvoboda.reviews.categories' ], |
|
32 | 32 | 'label' => 'Categories', |
33 | 33 | 'icon' => 'icon-folder', |
34 | 34 | 'url' => Backend::url('vojtasvoboda/reviews/categories'), |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | use ValidationTrait; |
15 | 15 | |
16 | - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; |
|
16 | + public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ]; |
|
17 | 17 | |
18 | 18 | public $table = 'vojtasvoboda_reviews_categories'; |
19 | 19 | |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | 'description' => 'max:10000', |
25 | 25 | ]; |
26 | 26 | |
27 | - public $translatable = ['name', 'slug', 'description']; |
|
27 | + public $translatable = [ 'name', 'slug', 'description' ]; |
|
28 | 28 | |
29 | - public $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
29 | + public $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
30 | 30 | |
31 | 31 | public $attachOne = [ |
32 | - 'image' => ['System\Models\File'], |
|
32 | + 'image' => [ 'System\Models\File' ], |
|
33 | 33 | ]; |
34 | 34 | |
35 | 35 | public $belongsToMany = [ |
36 | - 'reviews' => ['VojtaSvoboda\Reviews\Models\Review', |
|
36 | + 'reviews' => [ 'VojtaSvoboda\Reviews\Models\Review', |
|
37 | 37 | 'table' => 'vojtasvoboda_reviews_review_category', |
38 | 38 | 'order' => 'name desc', |
39 | 39 | 'scope' => 'isEnabled', |
@@ -36,8 +36,8 @@ |
||
36 | 36 | if ($categorySlug = $this->property('categoryFilter')) { |
37 | 37 | $category = $this->getCategory($categorySlug); |
38 | 38 | } |
39 | - $this->page['category'] = $category; |
|
40 | - $this->page['reviews'] = $this->reviews($category); |
|
39 | + $this->page[ 'category' ] = $category; |
|
40 | + $this->page[ 'reviews' ] = $this->reviews($category); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -14,7 +14,7 @@ |
||
14 | 14 | $table->increments('id')->unsigned(); |
15 | 15 | $table->integer('review_id')->unsigned()->nullable()->default(null); |
16 | 16 | $table->integer('category_id')->unsigned()->nullable()->default(null); |
17 | - $table->index(['review_id', 'category_id']); |
|
17 | + $table->index([ 'review_id', 'category_id' ]); |
|
18 | 18 | $table->foreign('review_id')->references('id')->on('vojtasvoboda_reviews_reviews')->onDelete('cascade'); |
19 | 19 | $table->foreign('category_id')->references('id')->on('vojtasvoboda_reviews_categories')->onDelete('cascade'); |
20 | 20 | $table->timestamps(); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | use ValidationTrait; |
25 | 25 | |
26 | - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; |
|
26 | + public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ]; |
|
27 | 27 | |
28 | 28 | /** @var string $table The database table used by the model */ |
29 | 29 | public $table = 'vojtasvoboda_reviews_reviews'; |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | 'content' => 'required|min:6|max:3000', |
38 | 38 | ]; |
39 | 39 | |
40 | - public $translatable = ['name', 'title', 'content']; |
|
40 | + public $translatable = [ 'name', 'title', 'content' ]; |
|
41 | 41 | |
42 | 42 | public $fillable = [ |
43 | 43 | 'email', 'name', 'title', 'rating', 'content', 'approved', |
44 | 44 | ]; |
45 | 45 | |
46 | - public $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
46 | + public $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
47 | 47 | |
48 | 48 | public $belongsToMany = [ |
49 | 49 | 'categories' => [ |
@@ -9,14 +9,14 @@ |
||
9 | 9 | { |
10 | 10 | public function up() |
11 | 11 | { |
12 | - Schema::table('vojtasvoboda_reviews_reviews', static function (Blueprint $table) { |
|
12 | + Schema::table('vojtasvoboda_reviews_reviews', static function(Blueprint $table) { |
|
13 | 13 | $table->integer('sort_order')->default(0)->change(); |
14 | 14 | }); |
15 | 15 | } |
16 | 16 | |
17 | 17 | public function down() |
18 | 18 | { |
19 | - Schema::table('vojtasvoboda_reviews_reviews', static function (Blueprint $table) { |
|
19 | + Schema::table('vojtasvoboda_reviews_reviews', static function(Blueprint $table) { |
|
20 | 20 | $table->boolean('sort_order')->nullable()->change(); |
21 | 21 | }); |
22 | 22 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | 'rating' => 'required' |
17 | 17 | ]; |
18 | 18 | |
19 | - public $categoryNameCache = []; |
|
19 | + public $categoryNameCache = [ ]; |
|
20 | 20 | |
21 | 21 | |
22 | 22 | public function importData($results, $sessionKey = null) |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | $reviewExists = $review->exists; |
42 | 42 | |
43 | - $except = ['id', 'categories', 'approved', 'created_at']; |
|
43 | + $except = [ 'id', 'categories', 'approved', 'created_at' ]; |
|
44 | 44 | |
45 | 45 | foreach (array_except($data, $except) as $attribute => $value) { |
46 | 46 | $review->{$attribute} = $value ?: null; |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | { |
74 | 74 | $categoryNames = $this->decodeArrayValue(array_get($data, 'categories')); |
75 | 75 | |
76 | - $ids = []; |
|
76 | + $ids = [ ]; |
|
77 | 77 | |
78 | 78 | foreach ($categoryNames as $name) { |
79 | 79 | if (!$name = trim($name)) { |
80 | 80 | continue; |
81 | 81 | } |
82 | 82 | |
83 | - if (isset($this->categoryNameCache[$name])) { |
|
84 | - $ids[] = $this->categoryNameCache[$name]; |
|
83 | + if (isset($this->categoryNameCache[ $name ])) { |
|
84 | + $ids[ ] = $this->categoryNameCache[ $name ]; |
|
85 | 85 | } else { |
86 | 86 | $category = CategoryModel::where('name', $name)->first(); |
87 | - $ids[] = $this->categoryNameCache[$name] = $category->id; |
|
87 | + $ids[ ] = $this->categoryNameCache[ $name ] = $category->id; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $category->{$attribute} = $value ?: null; |
48 | 48 | } |
49 | 49 | |
50 | - $category->enabled = !!array_get($data,'enabled'); |
|
50 | + $category->enabled = !!array_get($data, 'enabled'); |
|
51 | 51 | |
52 | 52 | $category->forceSave(); |
53 | 53 |