@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @var array |
35 | 35 | */ |
36 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
36 | + protected $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * The attributes that are mass assignable. |
40 | 40 | * |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - protected $fillable = ['name']; |
|
43 | + protected $fillable = [ 'name' ]; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Fields to search in fulltext mode |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return object |
72 | 72 | */ |
73 | - public function users(){ |
|
73 | + public function users() { |
|
74 | 74 | |
75 | 75 | return $this->hasMany('App\User', 'usergroup_id'); |
76 | 76 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param query $query |
82 | 82 | * @return query |
83 | 83 | */ |
84 | - public function scopeRelationships($query){ |
|
84 | + public function scopeRelationships($query) { |
|
85 | 85 | |
86 | 86 | return $query->with('users'); |
87 | 87 | } |
@@ -34,28 +34,28 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @var array |
36 | 36 | */ |
37 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
37 | + protected $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * The attributes that are mass assignable. |
41 | 41 | * |
42 | 42 | * @var array |
43 | 43 | */ |
44 | - protected $fillable = ['name', 'description', 'alt', 'url']; |
|
44 | + protected $fillable = [ 'name', 'description', 'alt', 'url' ]; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Columns to exclude from index |
48 | 48 | * |
49 | 49 | * @var array |
50 | 50 | */ |
51 | - protected $excludedFromIndex = []; |
|
51 | + protected $excludedFromIndex = [ ]; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Hidden from custom find |
55 | 55 | * |
56 | 56 | * @var arrat |
57 | 57 | */ |
58 | - protected $excludedFromFind = []; |
|
58 | + protected $excludedFromFind = [ ]; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Fields to search in fulltext mode |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return object |
102 | 102 | */ |
103 | - public function imagecategories(){ |
|
103 | + public function imagecategories() { |
|
104 | 104 | |
105 | 105 | return $this->belongsTo('App\ImageCategory', 'imagecategory_id'); |
106 | 106 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return object |
112 | 112 | */ |
113 | - public function slides(){ |
|
113 | + public function slides() { |
|
114 | 114 | |
115 | 115 | return $this->hasMany('App\Slide', 'image_id'); |
116 | 116 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return object |
122 | 122 | */ |
123 | - public function articlecategories(){ |
|
123 | + public function articlecategories() { |
|
124 | 124 | |
125 | 125 | return $this->hasMany('App\ArticleCategory', 'image_id'); |
126 | 126 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @return object |
132 | 132 | */ |
133 | - public function pages(){ |
|
133 | + public function pages() { |
|
134 | 134 | |
135 | 135 | return $this->hasMany('App\Page', 'image_id'); |
136 | 136 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param query $query |
142 | 142 | * @return query |
143 | 143 | */ |
144 | - public function scopeRelationships($query){ |
|
144 | + public function scopeRelationships($query) { |
|
145 | 145 | |
146 | 146 | return $query->with('imagecategories'); |
147 | 147 | } |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @param array $array |
153 | 153 | */ |
154 | - public function hide($array = []){ |
|
154 | + public function hide($array = [ ]) { |
|
155 | 155 | |
156 | - $this->hidden = ['image']; |
|
156 | + $this->hidden = [ 'image' ]; |
|
157 | 157 | } |
158 | 158 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public function __construct() { |
28 | 28 | parent::__construct(); |
29 | 29 | |
30 | - $this->middleware('add.lookup.tables:ImageCategory', ['only' => ['index','create','edit']]); |
|
30 | + $this->middleware('add.lookup.tables:ImageCategory', [ 'only' => [ 'index', 'create', 'edit' ] ]); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @var array |
47 | 47 | */ |
48 | - protected $binaryFields = []; |
|
48 | + protected $binaryFields = [ ]; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Get number of pagination rows |
52 | 52 | * |
53 | 53 | * @return integer |
54 | 54 | */ |
55 | - public function getRowsToPaginate(){ |
|
55 | + public function getRowsToPaginate() { |
|
56 | 56 | |
57 | 57 | return env('ADMIN_MEDIA_PAGINATE', 12); |
58 | 58 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param object $object |
64 | 64 | * @param Request $request |
65 | 65 | */ |
66 | - public function associateRelationships($object, Request $request){ |
|
66 | + public function associateRelationships($object, Request $request) { |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Validate category ID, if failed set to default |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * Validator OK - save it |
85 | 85 | */ |
86 | - else{ |
|
86 | + else { |
|
87 | 87 | |
88 | 88 | $object->imagecategories()->associate($request->input('imagecategory_id')); |
89 | 89 | } |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | /** |
108 | 108 | * Image has an url |
109 | 109 | */ |
110 | - if(strlen($request->input('url') > 5)){ |
|
110 | + if (strlen($request->input('url') > 5)) { |
|
111 | 111 | $object->addMedia($request->file('image'))->toMediaCollection('images') |
112 | 112 | ->usingName($request->input('url')); |
113 | 113 | } |
114 | - else{ |
|
114 | + else { |
|
115 | 115 | $object->addMedia($request->file('image'))->toMediaCollection('images'); |
116 | 116 | } |
117 | 117 |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Get META information |
42 | 42 | */ |
43 | - $imageMeta = Image::where(['url' => $request->imageName])->first(); |
|
43 | + $imageMeta = Image::where([ 'url' => $request->imageName ])->first(); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * File does not exist |
47 | 47 | */ |
48 | - if(empty($imageMeta) == TRUE){ |
|
48 | + if (empty($imageMeta) == TRUE) { |
|
49 | 49 | App::abort(404); |
50 | 50 | } |
51 | 51 | |
52 | 52 | $mediaItems = $imageMeta->getMedia(); |
53 | - $fullPathOnDisk = $mediaItems[0]->getPath(); |
|
53 | + $fullPathOnDisk = $mediaItems[ 0 ]->getPath(); |
|
54 | 54 | |
55 | 55 | |
56 | 56 | /** |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | 'Content-Description' => 'File Transfer', |
67 | 67 | 'Content-Transfer-Encoding' => 'binary', |
68 | 68 | 'Pragma' => 'public', |
69 | - 'Expires' => Carbon::createFromTimestamp(time()+3600)->toRfc2822String(), |
|
69 | + 'Expires' => Carbon::createFromTimestamp(time() + 3600)->toRfc2822String(), |
|
70 | 70 | 'Last-Modified' => $imageMeta->updated_at->toRfc2822String() |
71 | 71 | ); |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Response code cached |
75 | 75 | */ |
76 | - if( (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $imageMeta->image_etag) |
|
77 | - || (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $imageMeta->updated_at->toRfc2822String()) ){ |
|
76 | + if ((isset($_SERVER[ 'HTTP_IF_NONE_MATCH' ]) && $_SERVER[ 'HTTP_IF_NONE_MATCH' ] == $imageMeta->image_etag) |
|
77 | + || (isset($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ]) && $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ] == $imageMeta->updated_at->toRfc2822String())) { |
|
78 | 78 | |
79 | 79 | $responseCode = 304; |
80 | 80 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * Response code not cached, but OK |
84 | 84 | */ |
85 | - else{ |
|
85 | + else { |
|
86 | 86 | |
87 | 87 | $responseCode = 200; |
88 | 88 | } |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * Root |
17 | 17 | */ |
18 | -Route::get('/', ['as' => 'root', function () { |
|
18 | +Route::get('/', [ 'as' => 'root', function() { |
|
19 | 19 | return view('welcome'); |
20 | -}]); |
|
20 | +} ]); |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Main index |
24 | 24 | */ |
25 | -Route::get('/home', function () { |
|
25 | +Route::get('/home', function() { |
|
26 | 26 | |
27 | 27 | return redirect()->route('admin.dashboard.index'); |
28 | 28 | }); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * Admin |
32 | 32 | */ |
33 | -Route::group(['prefix' => env('APP_ADMIN_URL', 'admin'), 'as' => 'admin.', 'middleware' => ['web', 'auth']], function () { |
|
33 | +Route::group([ 'prefix' => env('APP_ADMIN_URL', 'admin'), 'as' => 'admin.', 'middleware' => [ 'web', 'auth' ] ], function() { |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * Articles and categories |
45 | 45 | */ |
46 | - Route::resource('page', 'Admin\PageController', ['names' => [ |
|
46 | + Route::resource('page', 'Admin\PageController', [ 'names' => [ |
|
47 | 47 | 'index' => 'page.index', |
48 | 48 | 'create' => 'page.create', |
49 | 49 | 'store' => 'page.store', |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | 'edit' => 'page.edit', |
52 | 52 | 'update' => 'page.update', |
53 | 53 | 'destroy' => 'page.destroy' |
54 | - ]]); |
|
55 | - Route::resource('pageCategory', 'Admin\PageCategoryController', ['names' => [ |
|
54 | + ] ]); |
|
55 | + Route::resource('pageCategory', 'Admin\PageCategoryController', [ 'names' => [ |
|
56 | 56 | 'index' => 'pageCategory.index', |
57 | 57 | 'create' => 'pageCategory.create', |
58 | 58 | 'store' => 'pageCategory.store', |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | 'edit' => 'pageCategory.edit', |
61 | 61 | 'update' => 'pageCategory.update', |
62 | 62 | 'destroy' => 'pageCategory.destroy' |
63 | - ]]); |
|
63 | + ] ]); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Articles and categories |
67 | 67 | */ |
68 | - Route::resource('article', 'Admin\ArticleController', ['names' => [ |
|
68 | + Route::resource('article', 'Admin\ArticleController', [ 'names' => [ |
|
69 | 69 | 'index' => 'article.index', |
70 | 70 | 'create' => 'article.create', |
71 | 71 | 'store' => 'article.store', |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | 'edit' => 'article.edit', |
74 | 74 | 'update' => 'article.update', |
75 | 75 | 'destroy' => 'article.destroy' |
76 | - ]]); |
|
77 | - Route::resource('articleCategory', 'Admin\ArticleCategoryController', ['names' => [ |
|
76 | + ] ]); |
|
77 | + Route::resource('articleCategory', 'Admin\ArticleCategoryController', [ 'names' => [ |
|
78 | 78 | 'index' => 'articleCategory.index', |
79 | 79 | 'create' => 'articleCategory.create', |
80 | 80 | 'store' => 'articleCategory.store', |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | 'edit' => 'articleCategory.edit', |
83 | 83 | 'update' => 'articleCategory.update', |
84 | 84 | 'destroy' => 'articleCategory.destroy' |
85 | - ]]); |
|
85 | + ] ]); |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Feedback |
89 | 89 | */ |
90 | - Route::resource('feedback', 'Admin\FeedbackController', ['names' => [ |
|
90 | + Route::resource('feedback', 'Admin\FeedbackController', [ 'names' => [ |
|
91 | 91 | 'index' => 'feedback.index', |
92 | 92 | 'create' => 'feedback.create', |
93 | 93 | 'store' => 'feedback.store', |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | 'edit' => 'feedback.edit', |
96 | 96 | 'update' => 'feedback.update', |
97 | 97 | 'destroy' => 'feedback.destroy' |
98 | - ]]); |
|
98 | + ] ]); |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Comment |
102 | 102 | */ |
103 | - Route::resource('comment', 'Admin\CommentController', ['names' => [ |
|
103 | + Route::resource('comment', 'Admin\CommentController', [ 'names' => [ |
|
104 | 104 | 'index' => 'comment.index', |
105 | 105 | 'create' => 'comment.create', |
106 | 106 | 'store' => 'comment.store', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'edit' => 'comment.edit', |
109 | 109 | 'update' => 'comment.update', |
110 | 110 | 'destroy' => 'comment.destroy' |
111 | - ]]); |
|
111 | + ] ]); |
|
112 | 112 | Route::get('comment/{id}/approve', [ |
113 | 113 | 'as' => 'comment.approve', 'uses' => 'Admin\CommentController@approve' |
114 | 114 | ]); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | /** |
120 | 120 | * Sliders and slides |
121 | 121 | */ |
122 | - Route::resource('slider', 'Admin\SliderController', ['names' => [ |
|
122 | + Route::resource('slider', 'Admin\SliderController', [ 'names' => [ |
|
123 | 123 | 'index' => 'slider.index', |
124 | 124 | 'create' => 'slider.create', |
125 | 125 | 'store' => 'slider.store', |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | 'edit' => 'slider.edit', |
128 | 128 | 'update' => 'slider.update', |
129 | 129 | 'destroy' => 'slider.destroy' |
130 | - ]]); |
|
131 | - Route::resource('slide', 'Admin\SlideController', ['names' => [ |
|
130 | + ] ]); |
|
131 | + Route::resource('slide', 'Admin\SlideController', [ 'names' => [ |
|
132 | 132 | 'index' => 'slide.index', |
133 | 133 | 'create' => 'slide.create', |
134 | 134 | 'store' => 'slide.store', |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | 'edit' => 'slide.edit', |
137 | 137 | 'update' => 'slide.update', |
138 | 138 | 'destroy' => 'slide.destroy' |
139 | - ]]); |
|
139 | + ] ]); |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * Images and categories |
143 | 143 | */ |
144 | - Route::resource('image', 'Admin\ImageController', ['names' => [ |
|
144 | + Route::resource('image', 'Admin\ImageController', [ 'names' => [ |
|
145 | 145 | 'index' => 'image.index', |
146 | 146 | 'create' => 'image.create', |
147 | 147 | 'store' => 'image.store', |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | 'edit' => 'image.edit', |
150 | 150 | 'update' => 'image.update', |
151 | 151 | 'destroy' => 'image.destroy' |
152 | - ]]); |
|
153 | - Route::resource('imageCategory', 'Admin\ImageCategoryController', ['names' => [ |
|
152 | + ] ]); |
|
153 | + Route::resource('imageCategory', 'Admin\ImageCategoryController', [ 'names' => [ |
|
154 | 154 | 'index' => 'imageCategory.index', |
155 | 155 | 'create' => 'imageCategory.create', |
156 | 156 | 'store' => 'imageCategory.store', |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | 'edit' => 'imageCategory.edit', |
159 | 159 | 'update' => 'imageCategory.update', |
160 | 160 | 'destroy' => 'imageCategory.destroy' |
161 | - ]]); |
|
161 | + ] ]); |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * Advertising |
165 | 165 | */ |
166 | - Route::resource('advert', 'Admin\AdvertController', ['names' => [ |
|
166 | + Route::resource('advert', 'Admin\AdvertController', [ 'names' => [ |
|
167 | 167 | 'index' => 'advert.index', |
168 | 168 | 'create' => 'advert.create', |
169 | 169 | 'store' => 'advert.store', |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | 'edit' => 'advert.edit', |
172 | 172 | 'update' => 'advert.update', |
173 | 173 | 'destroy' => 'advert.destroy' |
174 | - ]]); |
|
175 | - Route::resource('advertLocation', 'Admin\AdvertLocationController', ['names' => [ |
|
174 | + ] ]); |
|
175 | + Route::resource('advertLocation', 'Admin\AdvertLocationController', [ 'names' => [ |
|
176 | 176 | 'index' => 'advertLocation.index', |
177 | 177 | 'create' => 'advertLocation.create', |
178 | 178 | 'store' => 'advertLocation.store', |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | 'edit' => 'advertLocation.edit', |
181 | 181 | 'update' => 'advertLocation.update', |
182 | 182 | 'destroy' => 'advertLocation.destroy' |
183 | - ]]); |
|
183 | + ] ]); |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * Products and categories |
187 | 187 | */ |
188 | - Route::resource('productCategory', 'Admin\ProductCategoryController', ['names' => [ |
|
188 | + Route::resource('productCategory', 'Admin\ProductCategoryController', [ 'names' => [ |
|
189 | 189 | 'index' => 'productCategory.index', |
190 | 190 | 'create' => 'productCategory.create', |
191 | 191 | 'store' => 'productCategory.store', |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | 'edit' => 'productCategory.edit', |
194 | 194 | 'update' => 'productCategory.update', |
195 | 195 | 'destroy' => 'productCategory.destroy' |
196 | - ]]); |
|
197 | - Route::resource('product', 'Admin\ProductController', ['names' => [ |
|
196 | + ] ]); |
|
197 | + Route::resource('product', 'Admin\ProductController', [ 'names' => [ |
|
198 | 198 | 'index' => 'product.index', |
199 | 199 | 'create' => 'product.create', |
200 | 200 | 'store' => 'product.store', |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | 'edit' => 'product.edit', |
203 | 203 | 'update' => 'product.update', |
204 | 204 | 'destroy' => 'product.destroy' |
205 | - ]]); |
|
205 | + ] ]); |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Settings |
209 | 209 | */ |
210 | 210 | Route::resource('settings', 'Admin\SettingsController', [ |
211 | - 'except' => ['delete', 'show'], |
|
211 | + 'except' => [ 'delete', 'show' ], |
|
212 | 212 | 'names' => [ |
213 | 213 | 'index' => 'settings.index', |
214 | 214 | 'create' => 'settings.create', |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | 'edit' => 'settings.edit', |
218 | 218 | 'update' => 'settings.update', |
219 | 219 | 'destroy' => 'settings.destroy' |
220 | - ]]); |
|
220 | + ] ]); |
|
221 | 221 | |
222 | 222 | /** |
223 | 223 | * Users |
224 | 224 | */ |
225 | 225 | Route::resource('user', 'Admin\UserController', [ |
226 | - 'except' => ['show'], |
|
226 | + 'except' => [ 'show' ], |
|
227 | 227 | 'names' => [ |
228 | 228 | 'index' => 'user.index', |
229 | 229 | 'create' => 'user.create', |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | 'edit' => 'user.edit', |
233 | 233 | 'update' => 'user.update', |
234 | 234 | 'destroy' => 'user.destroy' |
235 | - ]]); |
|
235 | + ] ]); |
|
236 | 236 | |
237 | 237 | }); |
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Authentication |
241 | 241 | */ |
242 | -Route::group(['middleware' => 'web'], function () { |
|
242 | +Route::group([ 'middleware' => 'web' ], function() { |
|
243 | 243 | |
244 | 244 | Route::get('login', 'Auth\LoginController@showLoginForm')->name('login'); |
245 | 245 | Route::post('login', 'Auth\LoginController@login')->name('authPostLogin'); |
@@ -15,6 +15,6 @@ |
||
15 | 15 | /** |
16 | 16 | * Frontend root |
17 | 17 | */ |
18 | -Route::get('/', ['as' => 'root', function () { |
|
18 | +Route::get('/', [ 'as' => 'root', function() { |
|
19 | 19 | return view('welcome'); |
20 | -}]); |
|
20 | +} ]); |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | * @param $name |
28 | 28 | * @return |null |
29 | 29 | */ |
30 | - public static function getByName($name){ |
|
30 | + public static function getByName($name) { |
|
31 | 31 | $result = self::where('name', $name)->first(); |
32 | - if(!empty($result)){ |
|
32 | + if (!empty($result)) { |
|
33 | 33 | return $result->value; |
34 | 34 | } |
35 | - else{ |
|
35 | + else { |
|
36 | 36 | return null; |
37 | 37 | } |
38 | 38 | } |
@@ -50,21 +50,21 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @var array |
52 | 52 | */ |
53 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
53 | + protected $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * The attributes that are mass assignable. |
57 | 57 | * |
58 | 58 | * @var array |
59 | 59 | */ |
60 | - protected $fillable = ['name', 'value', 'description']; |
|
60 | + protected $fillable = [ 'name', 'value', 'description' ]; |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Columns to exclude from index |
64 | 64 | * |
65 | 65 | * @var array |
66 | 66 | */ |
67 | - protected $excludedFromIndex = []; |
|
67 | + protected $excludedFromIndex = [ ]; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Fields to search in fulltext mode |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | use App\Transaction; |
26 | 26 | use App\User; |
27 | 27 | |
28 | -class AdminModuleController extends Controller{ |
|
28 | +class AdminModuleController extends Controller { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Module name |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * Module name for blade |
145 | 145 | */ |
146 | 146 | $temp = explode('.', $this->moduleBasicRoute); |
147 | - View::share('moduleNameBlade', strtolower($temp[0] . "_module_" . $temp[1])); |
|
147 | + View::share('moduleNameBlade', strtolower($temp[ 0 ] . "_module_" . $temp[ 1 ])); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param $amount |
158 | 158 | */ |
159 | 159 | protected function _saveTransation($status_id = 1, $user_id, $amount, |
160 | - $campaign_id = null, $payment_id = null, $recommendation_id = null){ |
|
160 | + $campaign_id = null, $payment_id = null, $recommendation_id = null) { |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Save transaction |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param boolean $update |
188 | 188 | * @return boolean |
189 | 189 | */ |
190 | - public function saveMediaToStorage($object, $request, $update = FALSE){ |
|
190 | + public function saveMediaToStorage($object, $request, $update = FALSE) { |
|
191 | 191 | |
192 | 192 | return FALSE; |
193 | 193 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | return env('ADMIN_PAGINATE', 10); |
205 | 205 | } |
206 | - else{ |
|
206 | + else { |
|
207 | 207 | |
208 | 208 | return $this->paginateRows; |
209 | 209 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @param object $object |
216 | 216 | * @param Request $request |
217 | 217 | */ |
218 | - public function associateRelationships($object, Request $request){ |
|
218 | + public function associateRelationships($object, Request $request) { |
|
219 | 219 | |
220 | 220 | } |
221 | 221 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param object $object |
226 | 226 | * @param Request $request |
227 | 227 | */ |
228 | - public function associateRelationshipsWithID($object, Request $request){ |
|
228 | + public function associateRelationshipsWithID($object, Request $request) { |
|
229 | 229 | |
230 | 230 | } |
231 | 231 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @param object $object |
236 | 236 | */ |
237 | - public function resetCache($object){ |
|
237 | + public function resetCache($object) { |
|
238 | 238 | |
239 | 239 | } |
240 | 240 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param $arResult |
245 | 245 | * @return mixed |
246 | 246 | */ |
247 | - public function changeEditResultField($arResult){ |
|
247 | + public function changeEditResultField($arResult) { |
|
248 | 248 | return $arResult; |
249 | 249 | } |
250 | 250 | |
@@ -279,10 +279,10 @@ discard block |
||
279 | 279 | /** |
280 | 280 | * Get media |
281 | 281 | */ |
282 | - if(method_exists($arResults, 'getMedia')){ |
|
282 | + if (method_exists($arResults, 'getMedia')) { |
|
283 | 283 | $media = $arResults->getMedia(); |
284 | 284 | } |
285 | - else{ |
|
285 | + else { |
|
286 | 286 | $media = null; |
287 | 287 | } |
288 | 288 | |
@@ -290,17 +290,17 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * Choose the view |
292 | 292 | */ |
293 | - if(empty($this->customView['index']) == TRUE){ |
|
293 | + if (empty($this->customView[ 'index' ]) == TRUE) { |
|
294 | 294 | $view = $this->moduleBasicTemplatePath . '.index'; |
295 | 295 | } |
296 | - else{ |
|
296 | + else { |
|
297 | 297 | $view = $this->customView; |
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
301 | 301 | * Return page |
302 | 302 | */ |
303 | - return view($view, ['results' => $arResults, 'media' => $media]); |
|
303 | + return view($view, [ 'results' => $arResults, 'media' => $media ]); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -313,10 +313,10 @@ discard block |
||
313 | 313 | /** |
314 | 314 | * Choose the view |
315 | 315 | */ |
316 | - if(empty($this->customView['index']) == TRUE){ |
|
316 | + if (empty($this->customView[ 'index' ]) == TRUE) { |
|
317 | 317 | $view = $this->moduleBasicTemplatePath . '.create_edit'; |
318 | 318 | } |
319 | - else{ |
|
319 | + else { |
|
320 | 320 | $view = $this->customView; |
321 | 321 | } |
322 | 322 | |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | * Change the validation array |
339 | 339 | */ |
340 | 340 | foreach ($this->arValidationArray as $name => $value) { |
341 | - if(strpos($this->arValidationArray[$name], 'unique') > 0){ |
|
342 | - $this->arValidationArray[$name] = $value . ',NULL,id,deleted_at,NULL'; |
|
341 | + if (strpos($this->arValidationArray[ $name ], 'unique') > 0) { |
|
342 | + $this->arValidationArray[ $name ] = $value . ',NULL,id,deleted_at,NULL'; |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
@@ -362,16 +362,16 @@ discard block |
||
362 | 362 | /** |
363 | 363 | * Datetime |
364 | 364 | */ |
365 | - if(in_array($name, $this->dateTimeLocalFields)){ |
|
365 | + if (in_array($name, $this->dateTimeLocalFields)) { |
|
366 | 366 | |
367 | - $object->{$name} = str_replace('T', ' ', $request->input($name)). ':00'; |
|
367 | + $object->{$name} = str_replace('T', ' ', $request->input($name)) . ':00'; |
|
368 | 368 | } |
369 | 369 | else { |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Change to null if needed |
373 | 373 | */ |
374 | - if(strlen($request->$name) < 1){ |
|
374 | + if (strlen($request->$name) < 1) { |
|
375 | 375 | $object->{$name} = null; |
376 | 376 | } |
377 | 377 | else { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | /** |
406 | 406 | * Redirect to index |
407 | 407 | */ |
408 | - if(!empty($request->custom_route)){ |
|
408 | + if (!empty($request->custom_route)) { |
|
409 | 409 | return redirect($request->custom_route); |
410 | 410 | } |
411 | 411 | else { |
@@ -434,21 +434,21 @@ discard block |
||
434 | 434 | */ |
435 | 435 | if (empty($arResults)) { |
436 | 436 | |
437 | - return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors(['edit' => trans('validation.row_not_exist')]); |
|
437 | + return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors([ 'edit' => trans('validation.row_not_exist') ]); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
441 | 441 | * Set the put method for update |
442 | 442 | */ |
443 | - $arResults['_method'] = 'PUT'; |
|
443 | + $arResults[ '_method' ] = 'PUT'; |
|
444 | 444 | |
445 | 445 | /** |
446 | 446 | * Choose the view |
447 | 447 | */ |
448 | - if(empty($this->customView['index']) == TRUE){ |
|
448 | + if (empty($this->customView[ 'index' ]) == TRUE) { |
|
449 | 449 | $view = $this->moduleBasicTemplatePath . '.create_edit'; |
450 | 450 | } |
451 | - else{ |
|
451 | + else { |
|
452 | 452 | $view = $this->customView; |
453 | 453 | } |
454 | 454 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * Return page |
459 | 459 | */ |
460 | - return view($view, ['results' => $arResults]); |
|
460 | + return view($view, [ 'results' => $arResults ]); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | /** |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | */ |
486 | 486 | foreach ($this->arValidationArray as $name => $value) { |
487 | 487 | |
488 | - if(strpos($this->arValidationArray[$name], 'unique') > 0){ |
|
489 | - $this->arValidationArray[$name] = $value . ','.$id.',id,deleted_at,NULL'; |
|
488 | + if (strpos($this->arValidationArray[ $name ], 'unique') > 0) { |
|
489 | + $this->arValidationArray[ $name ] = $value . ',' . $id . ',id,deleted_at,NULL'; |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | */ |
507 | 507 | if ($arResults == FALSE) { |
508 | 508 | |
509 | - return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors(['edit' => trans('validation.row_not_exist')]); |
|
509 | + return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors([ 'edit' => trans('validation.row_not_exist') ]); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | /** |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | * Binary fields will not be updated if empty |
524 | 524 | * |
525 | 525 | */ |
526 | - if(in_array($name, $this->binaryFields)){ |
|
526 | + if (in_array($name, $this->binaryFields)) { |
|
527 | 527 | |
528 | 528 | } |
529 | - else{ |
|
529 | + else { |
|
530 | 530 | |
531 | 531 | /** |
532 | 532 | * Empty exception |
@@ -536,26 +536,26 @@ discard block |
||
536 | 536 | /** |
537 | 537 | * Datetime |
538 | 538 | */ |
539 | - if(in_array($name, $this->dateTimeLocalFields)){ |
|
539 | + if (in_array($name, $this->dateTimeLocalFields)) { |
|
540 | 540 | |
541 | - $arResults->$name = str_replace('T', ' ', $request->input($name)). ':00'; |
|
541 | + $arResults->$name = str_replace('T', ' ', $request->input($name)) . ':00'; |
|
542 | 542 | } |
543 | 543 | else { |
544 | 544 | $arResults->$name = $request->input($name); |
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
548 | - else{ |
|
548 | + else { |
|
549 | 549 | |
550 | 550 | /** |
551 | 551 | * Numeric zero ? |
552 | 552 | */ |
553 | - if(isset($request->$name) && is_numeric($request->input($name)) == TRUE){ |
|
553 | + if (isset($request->$name) && is_numeric($request->input($name)) == TRUE) { |
|
554 | 554 | |
555 | 555 | $arResults->$name = $request->input($name); |
556 | 556 | } |
557 | 557 | |
558 | - else{ |
|
558 | + else { |
|
559 | 559 | $arResults->$name = NULL; |
560 | 560 | } |
561 | 561 | } |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | /** |
574 | 574 | * Save media to storage |
575 | 575 | */ |
576 | - if($this->saveMediaToStorage($arResults, $request, TRUE) == TRUE){ |
|
576 | + if ($this->saveMediaToStorage($arResults, $request, TRUE) == TRUE) { |
|
577 | 577 | |
578 | 578 | // Update binary fields |
579 | 579 | foreach ($this->binaryFields as $name => $value) { |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | if (empty($request->$value) == FALSE) { |
582 | 582 | $arResults->$value = $request->$value; |
583 | 583 | } |
584 | - else{ |
|
584 | + else { |
|
585 | 585 | $arResults->$value = NULL; |
586 | 586 | } |
587 | 587 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | /** |
601 | 601 | * Redirect to index |
602 | 602 | */ |
603 | - if(!empty($request->custom_route)){ |
|
603 | + if (!empty($request->custom_route)) { |
|
604 | 604 | return redirect($request->custom_route); |
605 | 605 | } |
606 | 606 | else { |