@@ -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,15 +83,15 @@ 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 | } |
90 | 90 | |
91 | 91 | if ($letter && strlen($letter) == 1) { |
92 | 92 | $query |
93 | - ->where('name', 'LIKE', mb_strtolower($letter) . '%') |
|
94 | - ->orWhere('name', 'LIKE', mb_strtoupper($letter) . '%'); |
|
93 | + ->where('name', 'LIKE', mb_strtolower($letter).'%') |
|
94 | + ->orWhere('name', 'LIKE', mb_strtoupper($letter).'%'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | // order by |
@@ -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; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public function onRun() |
32 | 32 | { |
33 | - $this->page['letters'] = $this->letters = $this->getBrandLetters(); |
|
33 | + $this->page[ 'letters' ] = $this->letters = $this->getBrandLetters(); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | public function getBrandLetters() |
42 | 42 | { |
43 | 43 | // get unique letters |
44 | - $letters = []; |
|
44 | + $letters = [ ]; |
|
45 | 45 | Model::all()->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; |