@@ -14,7 +14,7 @@ |
||
14 | 14 | $table->increments('id')->unsigned(); |
15 | 15 | $table->integer('brand_id')->unsigned()->nullable()->default(null); |
16 | 16 | $table->integer('category_id')->unsigned()->nullable()->default(null); |
17 | - $table->index(['brand_id', 'category_id']); |
|
17 | + $table->index([ 'brand_id', 'category_id' ]); |
|
18 | 18 | $table->foreign('brand_id')->references('id')->on('vojtasvoboda_brands_brands')->onDelete('cascade'); |
19 | 19 | $table->foreign('category_id')->references('id')->on('vojtasvoboda_brands_categories')->onDelete('cascade'); |
20 | 20 | $table->timestamps(); |
@@ -40,8 +40,8 @@ |
||
40 | 40 | |
41 | 41 | public function onRun() |
42 | 42 | { |
43 | - $this->categoryPage = $this->page['categoryPage'] = $this->property('categoryPage'); |
|
44 | - $this->item = $this->page['item'] = $this->getItem(); |
|
43 | + $this->categoryPage = $this->page[ 'categoryPage' ] = $this->property('categoryPage'); |
|
44 | + $this->item = $this->page[ 'item' ] = $this->getItem(); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | protected function getItem() |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | if ($category = $this->property('categoryFilter')) { |
132 | 132 | $this->category = $this->getCategory($category); |
133 | 133 | } |
134 | - $this->page['category'] = $this->category; |
|
134 | + $this->page[ 'category' ] = $this->category; |
|
135 | 135 | |
136 | 136 | // letter filter |
137 | - $this->page['letter'] = $this->letter = $this->property('letterFilter'); |
|
137 | + $this->page[ 'letter' ] = $this->letter = $this->property('letterFilter'); |
|
138 | 138 | |
139 | 139 | // page links |
140 | - $this->brandPage = $this->page['brandPage'] = $this->property('brandPage'); |
|
141 | - $this->categoryPage = $this->page['categoryPage'] = $this->property('categoryPage'); |
|
140 | + $this->brandPage = $this->page[ 'brandPage' ] = $this->property('brandPage'); |
|
141 | + $this->categoryPage = $this->page[ 'categoryPage' ] = $this->property('categoryPage'); |
|
142 | 142 | |
143 | 143 | // brands vars |
144 | - $this->brands = $this->page['brands'] = $this->listItems(); |
|
145 | - $this->pagePath = $this->page['pagePath'] = Request::path(); |
|
144 | + $this->brands = $this->page[ 'brands' ] = $this->listItems(); |
|
145 | + $this->pagePath = $this->page[ 'pagePath' ] = Request::path(); |
|
146 | 146 | $this->columnSize = 12 / $this->property('perRow'); |
147 | 147 | $this->logoWidth = $this->property('logoWidth'); |
148 | 148 | $this->logoHeight = $this->property('logoHeight'); |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | ]; |
163 | 163 | |
164 | 164 | if ($this->category) { |
165 | - $parameters['category'] = $this->category; |
|
165 | + $parameters[ 'category' ] = $this->category; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | if ($this->letter) { |
169 | - $parameters['letter'] = $this->letter; |
|
169 | + $parameters[ 'letter' ] = $this->letter; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | $items = Brand::listFrontEnd($parameters); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $detailPage = $this->brandPage; |
187 | 187 | $categoryPage = $this->categoryPage; |
188 | 188 | |
189 | - $items->each(function ($item) use ($detailPage, $categoryPage) |
|
189 | + $items->each(function($item) use ($detailPage, $categoryPage) |
|
190 | 190 | { |
191 | 191 | if ($item->no_link) { |
192 | 192 | $item->url = null; |
@@ -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_brands_brands'; |
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 | - 'logo' => ['System\Models\File'], |
|
32 | + 'logo' => [ 'System\Models\File' ], |
|
33 | 33 | ]; |
34 | 34 | |
35 | 35 | public $attachMany = [ |
36 | - 'images' => ['System\Models\File'], |
|
36 | + 'images' => [ 'System\Models\File' ], |
|
37 | 37 | ]; |
38 | 38 | |
39 | 39 | public $belongsToMany = [ |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ], $options)); |
75 | 75 | |
76 | 76 | // search by config |
77 | - $searchableFields = ['name']; |
|
77 | + $searchableFields = [ 'name' ]; |
|
78 | 78 | |
79 | 79 | // only enabled |
80 | 80 | if ($enabled) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | // category filtration |
85 | 85 | if ($category instanceof Category) { |
86 | - $query->whereHas('categories', function ($query) use ($category) { |
|
86 | + $query->whereHas('categories', function($query) use ($category) { |
|
87 | 87 | $query->where('category_id', $category->id); |
88 | 88 | }); |
89 | 89 | } |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | if ($letter && strlen($letter) == 1) { |
92 | 92 | $query |
93 | 93 | ->where(function($q) use ($letter) { |
94 | - $q->where('name', 'LIKE', mb_strtolower($letter) . '%') |
|
95 | - ->orWhere('name', 'LIKE', mb_strtoupper($letter) . '%'); |
|
94 | + $q->where('name', 'LIKE', mb_strtolower($letter).'%') |
|
95 | + ->orWhere('name', 'LIKE', mb_strtoupper($letter).'%'); |
|
96 | 96 | }); |
97 | 97 | } |
98 | 98 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public function onRun() |
32 | 32 | { |
33 | - $this->page['characters'] = $this->characters = $this->getBrandCharacters(); |
|
33 | + $this->page[ 'characters' ] = $this->characters = $this->getBrandCharacters(); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | public function getBrandCharacters() |
42 | 42 | { |
43 | 43 | // get unique letters |
44 | - $letters = []; |
|
44 | + $letters = [ ]; |
|
45 | 45 | Model::isEnabled()->get()->each(function($brand) use (&$letters) |
46 | 46 | { |
47 | 47 | // get letter |
48 | 48 | $letter = mb_strtolower(mb_substr($brand->name, 0, 1)); |
49 | 49 | |
50 | 50 | // init array when doesn't exists |
51 | - if (!isset($letters[$letter])) { |
|
52 | - $letters[$letter] = [ |
|
51 | + if (!isset($letters[ $letter ])) { |
|
52 | + $letters[ $letter ] = [ |
|
53 | 53 | 'name' => $letter, |
54 | 54 | 'count' => 0, |
55 | 55 | 'url' => $this->controller->pageUrl($this->property('brandsPage'), [ |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | ]), |
58 | 58 | ]; |
59 | 59 | } |
60 | - $letters[$letter]['count']++; |
|
60 | + $letters[ $letter ][ 'count' ]++; |
|
61 | 61 | }); |
62 | 62 | |
63 | 63 | // sort them |
64 | 64 | usort($letters, function($a, $b) { |
65 | - if ($a['name'] == $b['name']) { |
|
65 | + if ($a[ 'name' ] == $b[ 'name' ]) { |
|
66 | 66 | return 0; |
67 | 67 | } |
68 | 68 | |
69 | - return $a['name'] > $b['name'] ? 1 : -1; |
|
69 | + return $a[ 'name' ] > $b[ 'name' ] ? 1 : -1; |
|
70 | 70 | }); |
71 | 71 | |
72 | 72 | return $letters; |
@@ -41,18 +41,18 @@ |
||
41 | 41 | 'label' => 'vojtasvoboda.brands::lang.navigation.label', |
42 | 42 | 'url' => Backend::url('vojtasvoboda/brands/brands'), |
43 | 43 | 'icon' => 'icon-tags', |
44 | - 'permissions' => ['vojtasvoboda.brands.brands'], |
|
44 | + 'permissions' => [ 'vojtasvoboda.brands.brands' ], |
|
45 | 45 | 'order' => 500, |
46 | 46 | 'sideMenu' => [ |
47 | 47 | 'brands' => [ |
48 | - 'permissions' => ['vojtasvoboda.brands.brands'], |
|
48 | + 'permissions' => [ 'vojtasvoboda.brands.brands' ], |
|
49 | 49 | 'label' => 'vojtasvoboda.brands::lang.navigation.sideMenu.items', |
50 | 50 | 'icon' => 'icon-tags', |
51 | 51 | 'url' => Backend::url('vojtasvoboda/brands/brands'), |
52 | 52 | 'order' => 100, |
53 | 53 | ], |
54 | 54 | 'categories' => [ |
55 | - 'permissions' => ['vojtasvoboda.brands.categories'], |
|
55 | + 'permissions' => [ 'vojtasvoboda.brands.categories' ], |
|
56 | 56 | 'label' => 'vojtasvoboda.brands::lang.navigation.sideMenu.categories', |
57 | 57 | 'icon' => 'icon-folder', |
58 | 58 | 'url' => Backend::url('vojtasvoboda/brands/categories'), |
@@ -38,15 +38,15 @@ |
||
38 | 38 | $key = 'vojtasvoboda_brands-Brands-Filter-listFilter'; |
39 | 39 | |
40 | 40 | // create new filter |
41 | - $filter['scope-category'] = [ |
|
41 | + $filter[ 'scope-category' ] = [ |
|
42 | 42 | $id => Category::find($id)->name, |
43 | 43 | ]; |
44 | 44 | |
45 | 45 | // save new filter |
46 | 46 | $encoded = base64_encode(serialize($filter)); |
47 | - $withoutFiltering = !isset($widgetSession[$key]); |
|
48 | - if ($withoutFiltering || $widgetSession[$key] !== $encoded) { |
|
49 | - $widgetSession[$key] = $encoded; |
|
47 | + $withoutFiltering = !isset($widgetSession[ $key ]); |
|
48 | + if ($withoutFiltering || $widgetSession[ $key ] !== $encoded) { |
|
49 | + $widgetSession[ $key ] = $encoded; |
|
50 | 50 | Session::put('widget', $widgetSession); |
51 | 51 | } |
52 | 52 | } |
@@ -33,9 +33,9 @@ |
||
33 | 33 | public function listOverrideColumnValue($record, $columnName, $definition = null) |
34 | 34 | { |
35 | 35 | if ($columnName == 'brands_count') { |
36 | - $link = Backend::url('vojtasvoboda/brands/brands?category=' . $record->id); |
|
36 | + $link = Backend::url('vojtasvoboda/brands/brands?category='.$record->id); |
|
37 | 37 | |
38 | - return '<a class="btn btn-xs btn-primary" href="' . $link . '">' . $record->brands_count . '</a>'; |
|
38 | + return '<a class="btn btn-xs btn-primary" href="'.$link.'">'.$record->brands_count.'</a>'; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
@@ -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_brands_categories'; |
19 | 19 | |
@@ -24,12 +24,12 @@ 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 = [ |