Passed
Push — master ( 3c2be5...ef5ef1 )
by Ferry
03:56
created
src/types/image/Hook.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function detailRender($row, $column)
29 29
     {
30 30
         $column->setValue($row->{ $column->getField() });
31
-        return view("types::image.detail",[
31
+        return view("types::image.detail", [
32 32
             'row'=>$row,
33 33
             'column'=>$column
34 34
         ]);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function indexRender($row, $column)
38 38
     {
39 39
         $column->setValue($row->{ $column->getField() });
40
-        return view("types::image.index",[
40
+        return view("types::image.index", [
41 41
             'row'=>$row,
42 42
             'column'=>$column
43 43
         ]);
Please login to merge, or discard this patch.
src/types/file/Hook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     public function detailRender($row, $column)
28 28
     {
29 29
         $column->setValue($row->{ $column->getField() });
30
-        return view("types::file.detail",[
30
+        return view("types::file.detail", [
31 31
             'row'=>$row,
32 32
             'column'=>$column
33 33
         ]);
Please login to merge, or discard this patch.
src/middlewares/CBBackend.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
18 18
      */
19 19
     public function handle($request, Closure $next)
20 20
     {
21
-        if(auth()->guest()) {
22
-            return cb()->redirect(cb()->getLoginUrl("login"),trans('crudbooster.not_logged_in'),'warning');
21
+        if (auth()->guest()) {
22
+            return cb()->redirect(cb()->getLoginUrl("login"), trans('crudbooster.not_logged_in'), 'warning');
23 23
         }
24 24
 
25 25
         (new CBHook())->beforeBackendMiddleware($request);
Please login to merge, or discard this patch.
src/helpers/Helper.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@  discard block
 block discarded – undo
9 9
 |
10 10
 */
11 11
 
12
-if(!function_exists('rglob')) {
12
+if (!function_exists('rglob')) {
13 13
     function rglob($pattern, $flags = 0) {
14 14
         $files = glob($pattern, $flags);
15
-        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
15
+        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
16 16
             $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags));
17 17
         }
18 18
         return $files;
19 19
     }
20 20
 }
21 21
 
22
-if(!function_exists('convertPHPToMomentFormat')) {
22
+if (!function_exists('convertPHPToMomentFormat')) {
23 23
     function convertPHPToMomentFormat($format)
24 24
     {
25 25
         $replacements = [
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
     }
67 67
 }
68 68
 
69
-if(!function_exists('slug')) {
69
+if (!function_exists('slug')) {
70 70
     function slug($string, $separator = '-') {
71 71
         return \Illuminate\Support\Str::slug($string, $separator);
72 72
     }
73 73
 }
74 74
 
75
-if(!function_exists('columnSingleton')) {
75
+if (!function_exists('columnSingleton')) {
76 76
     /**
77 77
      * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton
78 78
      */
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     }
82 82
 }
83 83
 
84
-if(!function_exists('cbHook'))
84
+if (!function_exists('cbHook'))
85 85
 {
86 86
     /**
87 87
      * @return crocodicstudio\crudbooster\hooks\CBHook
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     }
94 94
 }
95 95
 
96
-if(!function_exists('getTypeHook'))
96
+if (!function_exists('getTypeHook'))
97 97
 {
98 98
     /**
99 99
      * @param string $type
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     }
107 107
 }
108 108
 
109
-if(!function_exists('getPrimaryKey'))
109
+if (!function_exists('getPrimaryKey'))
110 110
 {
111 111
     function getPrimaryKey($table_name)
112 112
     {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     }
115 115
 }
116 116
 
117
-if(!function_exists('cb'))
117
+if (!function_exists('cb'))
118 118
 {
119 119
     function cb()
120 120
     {
@@ -122,25 +122,25 @@  discard block
 block discarded – undo
122 122
     }
123 123
 }
124 124
 
125
-if(!function_exists('cbAsset')) {
125
+if (!function_exists('cbAsset')) {
126 126
     function cbAsset($path) {
127 127
         return asset("cb_asset/".$path);
128 128
     }
129 129
 }
130 130
 
131
-if(!function_exists("cbConfig")) {
131
+if (!function_exists("cbConfig")) {
132 132
     function cbConfig($name) {
133 133
         return config("crudbooster.".$name);
134 134
     }
135 135
 }
136 136
 
137
-if(!function_exists("strRandom")) {
137
+if (!function_exists("strRandom")) {
138 138
     function strRandom($length = 5) {
139 139
         return \Illuminate\Support\Str::random($length);
140 140
     }
141 141
 }
142 142
 
143
-if(!function_exists('module')) {
143
+if (!function_exists('module')) {
144 144
     function module()
145 145
     {
146 146
         $module = new \crocodicstudio\crudbooster\helpers\Module();
@@ -148,43 +148,43 @@  discard block
 block discarded – undo
148 148
     }
149 149
 }
150 150
 
151
-if(!function_exists('getAdminLoginURL')) {
151
+if (!function_exists('getAdminLoginURL')) {
152 152
     function getAdminLoginURL()
153 153
     {
154 154
         return url(config('crudbooster.ADMIN_LOGIN_PATH'));
155 155
     }
156 156
 }
157 157
 
158
-if(!function_exists('dummyPhoto')) {
158
+if (!function_exists('dummyPhoto')) {
159 159
     function dummyPhoto()
160 160
     {
161 161
         return config('crudbooster.DUMMY_PHOTO');
162 162
     }
163 163
 }
164 164
 
165
-if(!function_exists('assetThumbnail')) {
165
+if (!function_exists('assetThumbnail')) {
166 166
 	function assetThumbnail($path) {
167
-		$path = str_replace('uploads/','uploads_thumbnail/',$path);
167
+		$path = str_replace('uploads/', 'uploads_thumbnail/', $path);
168 168
 		return asset($path);
169 169
 	}
170 170
 }
171 171
 
172
-if(!function_exists('assetResize')) {
173
-	function assetResize($path,$width,$height=null,$quality=70) {
172
+if (!function_exists('assetResize')) {
173
+	function assetResize($path, $width, $height = null, $quality = 70) {
174 174
 		$basename = basename($path);
175 175
 	    $pathWithoutName = str_replace($basename, '', $path);
176 176
 	    $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
177
-	    if(Storage::exists($newLocation)) {
177
+	    if (Storage::exists($newLocation)) {
178 178
 	        return asset($newLocation);
179
-	    }else{
180
-	        $img = Image::make(storage_path($path))->fit($width,$height);
181
-	        $img->save(storage_path($newLocation),$quality);
179
+	    } else {
180
+	        $img = Image::make(storage_path($path))->fit($width, $height);
181
+	        $img->save(storage_path($newLocation), $quality);
182 182
 	        return asset($newLocation);
183 183
 	    }
184 184
 	}
185 185
 }
186 186
 
187
-if(!function_exists('extract_unit')) {	
187
+if (!function_exists('extract_unit')) {	
188 188
 	/*
189 189
 	Credits: Bit Repository
190 190
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 }
203 203
 
204 204
 
205
-if(!function_exists('now')) {
205
+if (!function_exists('now')) {
206 206
 	function now() {		
207 207
 		return date('Y-m-d H:i:s');
208 208
 	}
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 |
217 217
 */
218 218
 
219
-if(!function_exists('putSetting')) {
219
+if (!function_exists('putSetting')) {
220 220
     function putSetting($key, $value)
221 221
     {
222
-        if(file_exists(storage_path('.cbconfig'))) {
222
+        if (file_exists(storage_path('.cbconfig'))) {
223 223
             $settings = file_get_contents(storage_path('.cbconfig'));
224 224
             $settings = unserialize($settings);
225
-        }else{
225
+        } else {
226 226
             $settings = [];
227 227
         }
228 228
 
@@ -233,25 +233,25 @@  discard block
 block discarded – undo
233 233
     }
234 234
 }
235 235
 
236
-if(!function_exists('getSetting')) {
236
+if (!function_exists('getSetting')) {
237 237
     function getSetting($key, $default = null)
238 238
     {
239
-        if(file_exists(storage_path('.cbconfig'))) {
239
+        if (file_exists(storage_path('.cbconfig'))) {
240 240
             $settings = file_get_contents(storage_path('.cbconfig'));
241 241
             $settings = unserialize($settings);
242
-        }else{
242
+        } else {
243 243
             $settings = [];
244 244
         }
245 245
 
246
-        if(isset($settings[$key])) {
247
-            return $settings[$key]?:$default;
248
-        }else{
246
+        if (isset($settings[$key])) {
247
+            return $settings[$key] ?: $default;
248
+        } else {
249 249
             return $default;
250 250
         }
251 251
     }
252 252
 }
253 253
 
254
-if(!function_exists('timeAgo')) {
254
+if (!function_exists('timeAgo')) {
255 255
     function timeAgo($datetime_to, $datetime_from = null, $full = false)
256 256
     {
257 257
         $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             }
283 283
         }
284 284
 
285
-        if (! $full) {
285
+        if (!$full) {
286 286
             $string = array_slice($string, 0, 1);
287 287
         }
288 288
 
@@ -290,22 +290,22 @@  discard block
 block discarded – undo
290 290
     }
291 291
 }
292 292
 
293
-if(!function_exists("array_map_r")) {
294
-    function array_map_r( $func, $arr )
293
+if (!function_exists("array_map_r")) {
294
+    function array_map_r($func, $arr)
295 295
     {
296 296
         $newArr = array();
297 297
 
298
-        foreach( $arr as $key => $value )
298
+        foreach ($arr as $key => $value)
299 299
         {
300 300
             $key = $func($key);
301
-            $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) );
301
+            $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value)));
302 302
         }
303 303
 
304 304
         return $newArr;
305 305
     }
306 306
 }
307 307
 
308
-if(!function_exists("sanitizeXSS"))
308
+if (!function_exists("sanitizeXSS"))
309 309
 {
310 310
     function sanitizeXSS($value)
311 311
     {
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     }
318 318
 }
319 319
 
320
-if(!function_exists("requestAll")) {
320
+if (!function_exists("requestAll")) {
321 321
     function requestAll() {
322 322
         $all = array_map_r("sanitizeXSS", request()->all());
323 323
         return $all;
@@ -326,22 +326,22 @@  discard block
 block discarded – undo
326 326
 
327 327
 
328 328
 
329
-if(!function_exists('getURLFormat')) {
329
+if (!function_exists('getURLFormat')) {
330 330
     function getURLFormat($name) {
331 331
         $url = request($name);
332
-        if(filter_var($url, FILTER_VALIDATE_URL)) {
332
+        if (filter_var($url, FILTER_VALIDATE_URL)) {
333 333
             return $url;
334
-        }else{
334
+        } else {
335 335
             return request()->url();
336 336
         }
337 337
     }
338 338
 }
339 339
 
340
-if(!function_exists('g')) {
340
+if (!function_exists('g')) {
341 341
     function g($name, $safe = true) {
342
-        if($safe == true) {
342
+        if ($safe == true) {
343 343
             $response = request($name);
344
-            if(is_string($response)) {
344
+            if (is_string($response)) {
345 345
                 $response = sanitizeXSS($response);
346 346
             }elseif (is_array($response)) {
347 347
                 array_walk_recursive($response, function(&$response) {
@@ -350,25 +350,25 @@  discard block
 block discarded – undo
350 350
             }
351 351
 
352 352
             return $response;
353
-        }else{
353
+        } else {
354 354
             return Request::get($name);
355 355
         }
356 356
     }
357 357
 }
358 358
 
359
-if(!function_exists('min_var_export')) {
359
+if (!function_exists('min_var_export')) {
360 360
     function min_var_export($input) {
361
-        if(is_array($input)) {
361
+        if (is_array($input)) {
362 362
             $buffer = [];
363
-            foreach($input as $key => $value)
363
+            foreach ($input as $key => $value)
364 364
                 $buffer[] = var_export($key, true)."=>".min_var_export($value);
365
-            return "[".implode(",",$buffer)."]";
365
+            return "[".implode(",", $buffer)."]";
366 366
         } else
367 367
             return var_export($input, true);
368 368
     }
369 369
 }
370 370
 
371
-if(!function_exists('rrmdir')) {
371
+if (!function_exists('rrmdir')) {
372 372
 	/*
373 373
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
374 374
 	*/
Please login to merge, or discard this patch.
src/CRUDBoosterServiceProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
         $this->loadViewsFrom(__DIR__.'/types', 'types');
25 25
 
26 26
         // Publish the files
27
-        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')],'cb_config');            
27
+        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')], 'cb_config');            
28 28
         $this->publishes([__DIR__.'/localization' => resource_path('lang')], 'cb_localization');                 
29
-        $this->publishes([__DIR__.'/database' => base_path('database')],'cb_migration');
30
-        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')],'cb_hook');
31
-        $this->publishes([__DIR__ . '/assets' =>public_path('cb_asset')],'cb_asset');
29
+        $this->publishes([__DIR__.'/database' => base_path('database')], 'cb_migration');
30
+        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')], 'cb_hook');
31
+        $this->publishes([__DIR__.'/assets' =>public_path('cb_asset')], 'cb_asset');
32 32
                     
33 33
         require __DIR__.'/validations/validation.php';        
34 34
         require __DIR__.'/routes.php';
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
         require __DIR__.'/helpers/Helper.php';
47 47
 
48 48
         // Singletons
49
-        $this->app->singleton('crudbooster', function ()
49
+        $this->app->singleton('crudbooster', function()
50 50
         {
51 51
             return true;
52 52
         });
53 53
         $this->app->singleton('ColumnSingleton', ColumnSingleton::class);
54 54
 
55 55
         // Merging configuration
56
-        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php','crudbooster');
56
+        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php', 'crudbooster');
57 57
 
58 58
 
59 59
         // Register Commands
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
     private function registerTypeRoutes() {
75 75
         $routes = rglob(__DIR__.DIRECTORY_SEPARATOR."types".DIRECTORY_SEPARATOR."Route.php");
76
-        foreach($routes as $route) {
76
+        foreach ($routes as $route) {
77 77
             require $route;
78 78
         }
79 79
     }
Please login to merge, or discard this patch.
src/types/file/FileController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@
 block discarded – undo
14 14
 {
15 15
     public function postUploadFile()
16 16
     {
17
-        if(auth()->guest()) return redirect(cb()->getLoginUrl());
17
+        if (auth()->guest()) return redirect(cb()->getLoginUrl());
18 18
 
19 19
         $file = null;
20 20
         try {
21 21
 
22 22
             cb()->validation([
23
-                'userfile' => 'required|mimes:' . implode(",",config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED'))
23
+                'userfile' => 'required|mimes:'.implode(",", config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED'))
24 24
             ]);
25 25
 
26 26
             $file = cb()->uploadFile('userfile', true);
27 27
 
28 28
         } catch (CBValidationException $e) {
29
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
29
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
30 30
         } catch (\Exception $e) {
31
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
31
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
32 32
         }
33 33
 
34 34
         return response()->json([
Please login to merge, or discard this patch.
src/types/file/Route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-cb()->routeGroupBackend(function () {
4
-    cb()->routePost("upload-file",'\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
3
+cb()->routeGroupBackend(function() {
4
+    cb()->routePost("upload-file", '\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
5 5
 });
6 6
\ No newline at end of file
Please login to merge, or discard this patch.
src/types/radio/component.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
         <?php /** @var \crocodicstudio\crudbooster\types\radio\RadioModel $column */ ?>
3 3
         @foreach($column->getOptions() as $key=>$value)
4 4
             <?php
5
-                $columnValue = old($column->getName())?:($column->getDefaultValue())?:$column->getValue();
5
+                $columnValue = old($column->getName()) ?: ($column->getDefaultValue()) ?: $column->getValue();
6 6
             ?>
7 7
             <div class="{{ $column->getDisabled()?"disabled":"" }}">
8 8
                 <label class='radio-inline'>
Please login to merge, or discard this patch.
src/types/wysiwyg/Hook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     public function indexRender($row, $column)
23 23
     {
24 24
         $value = trim(strip_tags($row->{ $column->getField() }));
25
-        if($column->getLimit()) {
25
+        if ($column->getLimit()) {
26 26
             $value = Str::limit($value, $column->getLimit());
27 27
         }
28 28
         return $value;
Please login to merge, or discard this patch.