@@ -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,9 +16,9 @@ discard block |
||
| 16 | 16 | 'rating' => 'required|numeric' |
| 17 | 17 | ]; |
| 18 | 18 | |
| 19 | - public $categoryNameCache = []; |
|
| 19 | + public $categoryNameCache = [ ]; |
|
| 20 | 20 | |
| 21 | - public $categoryIdCache = []; |
|
| 21 | + public $categoryIdCache = [ ]; |
|
| 22 | 22 | |
| 23 | 23 | public function importData($results, $sessionKey = null) |
| 24 | 24 | { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $reviewExists = $review->exists; |
| 43 | 43 | |
| 44 | - $except = ['id', 'category_names', 'category_ids','approved', 'created_at']; |
|
| 44 | + $except = [ 'id', 'category_names', 'category_ids', 'approved', 'created_at' ]; |
|
| 45 | 45 | |
| 46 | 46 | foreach (array_except($data, $except) as $attribute => $value) { |
| 47 | 47 | |
@@ -87,19 +87,19 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | $categoryIds = $this->decodeArrayValue(array_get($data, 'category_ids')); |
| 89 | 89 | |
| 90 | - $ids = []; |
|
| 90 | + $ids = [ ]; |
|
| 91 | 91 | |
| 92 | 92 | foreach ($categoryIds as $id) { |
| 93 | 93 | if (!$id = trim($id)) { |
| 94 | 94 | continue; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if (isset($this->categoryIdCache[$id])) { |
|
| 98 | - $ids[] = $this->categoryIdCache[$id]; |
|
| 97 | + if (isset($this->categoryIdCache[ $id ])) { |
|
| 98 | + $ids[ ] = $this->categoryIdCache[ $id ]; |
|
| 99 | 99 | } else { |
| 100 | 100 | $category = CategoryModel::find($id); |
| 101 | - if($category) { |
|
| 102 | - $ids[] = $this->categoryIdCache[$id] = $category->id; |
|
| 101 | + if ($category) { |
|
| 102 | + $ids[ ] = $this->categoryIdCache[ $id ] = $category->id; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -111,19 +111,19 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | $categoryNames = $this->decodeArrayValue(array_get($data, 'category_names')); |
| 113 | 113 | |
| 114 | - $ids = []; |
|
| 114 | + $ids = [ ]; |
|
| 115 | 115 | |
| 116 | 116 | foreach ($categoryNames as $name) { |
| 117 | 117 | if (!$name = trim($name)) { |
| 118 | 118 | continue; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if (isset($this->categoryNameCache[$name])) { |
|
| 122 | - $ids[] = $this->categoryNameCache[$name]; |
|
| 121 | + if (isset($this->categoryNameCache[ $name ])) { |
|
| 122 | + $ids[ ] = $this->categoryNameCache[ $name ]; |
|
| 123 | 123 | } else { |
| 124 | 124 | $category = CategoryModel::where('name', $name)->first(); |
| 125 | - if($category) { |
|
| 126 | - $ids[] = $this->categoryNameCache[$name] = $category->id; |
|
| 125 | + if ($category) { |
|
| 126 | + $ids[ ] = $this->categoryNameCache[ $name ] = $category->id; |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -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->save(); |
| 53 | 53 | |