@@ -126,8 +126,7 @@ |
||
| 126 | 126 | { |
| 127 | 127 | return round((($thisValue / ($lastValue / 100)) - 100), $round); |
| 128 | 128 | |
| 129 | - } |
|
| 130 | - else { |
|
| 129 | + } else { |
|
| 131 | 130 | |
| 132 | 131 | return 0; |
| 133 | 132 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | use Illuminate\Support\Facades\View; |
| 20 | 20 | use App\Http\Controllers\Controller; |
| 21 | 21 | |
| 22 | -class AdminModuleController extends Controller{ |
|
| 22 | +class AdminModuleController extends Controller { |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Module name |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * Module name for blade |
| 125 | 125 | */ |
| 126 | 126 | $temp = explode('.', $this->moduleBasicRoute); |
| 127 | - View::share('moduleNameBlade', strtolower($temp[0] . "_module_" . $temp[1])); |
|
| 127 | + View::share('moduleNameBlade', strtolower($temp[ 0 ] . "_module_" . $temp[ 1 ])); |
|
| 128 | 128 | |
| 129 | 129 | } |
| 130 | 130 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param boolean $update |
| 137 | 137 | * @return boolean |
| 138 | 138 | */ |
| 139 | - public function saveMediaToStorage($object, $request, $update = FALSE){ |
|
| 139 | + public function saveMediaToStorage($object, $request, $update = FALSE) { |
|
| 140 | 140 | |
| 141 | 141 | return FALSE; |
| 142 | 142 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | return env('ADMIN_PAGINATE', 10); |
| 154 | 154 | } |
| 155 | - else{ |
|
| 155 | + else { |
|
| 156 | 156 | |
| 157 | 157 | return $this->paginateRows; |
| 158 | 158 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @param object $object |
| 165 | 165 | * @param Request $request |
| 166 | 166 | */ |
| 167 | - public function associateRelationships($object, Request $request){ |
|
| 167 | + public function associateRelationships($object, Request $request) { |
|
| 168 | 168 | |
| 169 | 169 | } |
| 170 | 170 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @param object $object |
| 175 | 175 | * @param Request $request |
| 176 | 176 | */ |
| 177 | - public function associateRelationshipsWithID($object, Request $request){ |
|
| 177 | + public function associateRelationshipsWithID($object, Request $request) { |
|
| 178 | 178 | |
| 179 | 179 | } |
| 180 | 180 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * |
| 184 | 184 | * @param object $object |
| 185 | 185 | */ |
| 186 | - public function resetCache($object){ |
|
| 186 | + public function resetCache($object) { |
|
| 187 | 187 | |
| 188 | 188 | } |
| 189 | 189 | |
@@ -217,17 +217,17 @@ discard block |
||
| 217 | 217 | /** |
| 218 | 218 | * Choose the view |
| 219 | 219 | */ |
| 220 | - if(empty($this->customView['index']) == TRUE){ |
|
| 220 | + if (empty($this->customView[ 'index' ]) == TRUE) { |
|
| 221 | 221 | $view = $this->moduleBasicTemplatePath . '.index'; |
| 222 | 222 | } |
| 223 | - else{ |
|
| 223 | + else { |
|
| 224 | 224 | $view = $this->customView; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
| 228 | 228 | * Return page |
| 229 | 229 | */ |
| 230 | - return view($view, array_merge(['results' => $arResults])); |
|
| 230 | + return view($view, array_merge([ 'results' => $arResults ])); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | /** |
| 241 | 241 | * Choose the view |
| 242 | 242 | */ |
| 243 | - if(empty($this->customView['index']) == TRUE){ |
|
| 243 | + if (empty($this->customView[ 'index' ]) == TRUE) { |
|
| 244 | 244 | $view = $this->moduleBasicTemplatePath . '.create_edit'; |
| 245 | 245 | } |
| 246 | - else{ |
|
| 246 | + else { |
|
| 247 | 247 | $view = $this->customView; |
| 248 | 248 | } |
| 249 | 249 | |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | * Change the validation array |
| 266 | 266 | */ |
| 267 | 267 | foreach ($this->arValidationArray as $name => $value) { |
| 268 | - if(strpos($this->arValidationArray[$name], 'unique') > 0){ |
|
| 269 | - $this->arValidationArray[$name] = $value . ',NULL,id,deleted_at,NULL'; |
|
| 268 | + if (strpos($this->arValidationArray[ $name ], 'unique') > 0) { |
|
| 269 | + $this->arValidationArray[ $name ] = $value . ',NULL,id,deleted_at,NULL'; |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
@@ -329,35 +329,35 @@ discard block |
||
| 329 | 329 | * Get the row |
| 330 | 330 | */ |
| 331 | 331 | $arResults = $modelClass::where('id', $id)->relationships()->excludeFromFind()->get(); |
| 332 | - $arResults = $arResults[0]; |
|
| 332 | + $arResults = $arResults[ 0 ]; |
|
| 333 | 333 | |
| 334 | 334 | /** |
| 335 | 335 | * Row does not exist - redirect |
| 336 | 336 | */ |
| 337 | 337 | if (count($arResults) == 0) { |
| 338 | 338 | |
| 339 | - return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors(['edit' => trans('validation.row_not_exist')]); |
|
| 339 | + return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors([ 'edit' => trans('validation.row_not_exist') ]); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /** |
| 343 | 343 | * Set the put method for update |
| 344 | 344 | */ |
| 345 | - $arResults['_method'] = 'PUT'; |
|
| 345 | + $arResults[ '_method' ] = 'PUT'; |
|
| 346 | 346 | |
| 347 | 347 | /** |
| 348 | 348 | * Choose the view |
| 349 | 349 | */ |
| 350 | - if(empty($this->customView['index']) == TRUE){ |
|
| 350 | + if (empty($this->customView[ 'index' ]) == TRUE) { |
|
| 351 | 351 | $view = $this->moduleBasicTemplatePath . '.create_edit'; |
| 352 | 352 | } |
| 353 | - else{ |
|
| 353 | + else { |
|
| 354 | 354 | $view = $this->customView; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
| 358 | 358 | * Return page |
| 359 | 359 | */ |
| 360 | - return view($view, ['results' => $arResults]); |
|
| 360 | + return view($view, [ 'results' => $arResults ]); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | foreach ($this->arValidationArray as $name => $value) { |
| 386 | 386 | |
| 387 | - if(strpos($this->arValidationArray[$name], 'unique') > 0){ |
|
| 388 | - $this->arValidationArray[$name] = $value . ','.$id.',id,deleted_at,NULL'; |
|
| 387 | + if (strpos($this->arValidationArray[ $name ], 'unique') > 0) { |
|
| 388 | + $this->arValidationArray[ $name ] = $value . ',' . $id . ',id,deleted_at,NULL'; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | if ($arResults == FALSE) { |
| 407 | 407 | |
| 408 | - return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors(['edit' => trans('validation.row_not_exist')]); |
|
| 408 | + return redirect(route($this->moduleBasicRoute . '.index'))->withInput()->withErrors([ 'edit' => trans('validation.row_not_exist') ]); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
@@ -422,10 +422,10 @@ discard block |
||
| 422 | 422 | * Binary fields will not be updated if empty |
| 423 | 423 | * |
| 424 | 424 | */ |
| 425 | - if(in_array($name, $this->binaryFields)){ |
|
| 425 | + if (in_array($name, $this->binaryFields)) { |
|
| 426 | 426 | |
| 427 | 427 | } |
| 428 | - else{ |
|
| 428 | + else { |
|
| 429 | 429 | |
| 430 | 430 | /** |
| 431 | 431 | * Empty exception |
@@ -434,17 +434,17 @@ discard block |
||
| 434 | 434 | $arResults->$name = $request->input($name); |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - else{ |
|
| 437 | + else { |
|
| 438 | 438 | |
| 439 | 439 | /** |
| 440 | 440 | * Numeric zero ? |
| 441 | 441 | */ |
| 442 | - if(isset($request->name) && is_numeric($request->input($name)) == TRUE){ |
|
| 442 | + if (isset($request->name) && is_numeric($request->input($name)) == TRUE) { |
|
| 443 | 443 | |
| 444 | 444 | $arResults->$name = $request->input($name); |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - else{ |
|
| 447 | + else { |
|
| 448 | 448 | $arResults->$name = NULL; |
| 449 | 449 | } |
| 450 | 450 | } |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | /** |
| 462 | 462 | * Save media to storage |
| 463 | 463 | */ |
| 464 | - if($this->saveMediaToStorage($arResults, $request, TRUE) == TRUE){ |
|
| 464 | + if ($this->saveMediaToStorage($arResults, $request, TRUE) == TRUE) { |
|
| 465 | 465 | |
| 466 | 466 | // Update binary fields |
| 467 | 467 | foreach ($this->binaryFields as $name => $value) { |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | if (empty($request->$value) == FALSE) { |
| 470 | 470 | $arResults->$value = $request->$value; |
| 471 | 471 | } |
| 472 | - else{ |
|
| 472 | + else { |
|
| 473 | 473 | $arResults->$value = NULL; |
| 474 | 474 | } |
| 475 | 475 | } |
@@ -24,5 +24,5 @@ |
||
| 24 | 24 | protected $arValidationArray = [ |
| 25 | 25 | 'name' => 'required|max:255|unique:settings,name', |
| 26 | 26 | 'value' => 'max:255', |
| 27 | - 'description' => 'max:255']; |
|
| 27 | + 'description' => 'max:255' ]; |
|
| 28 | 28 | } |
@@ -52,17 +52,17 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * File not cached |
| 54 | 54 | */ |
| 55 | - else{ |
|
| 55 | + else { |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * Get META information |
| 59 | 59 | */ |
| 60 | - $imageMeta = Image::where(['url' => $request->imageName, 'image_extension' => $request->imageExtension])->first(['image_mime_type', 'image_size', 'id', 'updated_at', 'image_etag']); |
|
| 60 | + $imageMeta = Image::where([ 'url' => $request->imageName, 'image_extension' => $request->imageExtension ])->first([ 'image_mime_type', 'image_size', 'id', 'updated_at', 'image_etag' ]); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * File does not exist |
| 64 | 64 | */ |
| 65 | - if(empty($imageMeta) == TRUE){ |
|
| 65 | + if (empty($imageMeta) == TRUE) { |
|
| 66 | 66 | App::abort(404); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | 'Content-Type' => $imageMeta->image_mime_type, |
| 92 | 92 | 'Content-Transfer-Encoding' => 'binary', |
| 93 | 93 | 'Pragma' => 'public', |
| 94 | - 'Expires' => Carbon::createFromTimestamp(time()+3600)->toRfc2822String(), |
|
| 94 | + 'Expires' => Carbon::createFromTimestamp(time() + 3600)->toRfc2822String(), |
|
| 95 | 95 | 'Last-Modified' => $imageMeta->updated_at->toRfc2822String(), |
| 96 | 96 | 'Etag' => $imageMeta->image_etag, |
| 97 | 97 | ); |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * Response code cached |
| 101 | 101 | */ |
| 102 | - if( (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $imageMeta->image_etag) |
|
| 103 | - || (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && @$_SERVER['HTTP_IF_MODIFIED_SINCE'] == $imageMeta->updated_at->toRfc2822String()) ){ |
|
| 102 | + if ((isset($_SERVER[ 'HTTP_IF_NONE_MATCH' ]) && $_SERVER[ 'HTTP_IF_NONE_MATCH' ] == $imageMeta->image_etag) |
|
| 103 | + || (isset($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ]) && @$_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ] == $imageMeta->updated_at->toRfc2822String())) { |
|
| 104 | 104 | |
| 105 | 105 | $responseCode = 304; |
| 106 | 106 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * Response code not cached, but OK |
| 110 | 110 | */ |
| 111 | - else{ |
|
| 111 | + else { |
|
| 112 | 112 | |
| 113 | 113 | $responseCode = 200; |
| 114 | 114 | } |