Passed
Push — master ( 5403d4...38a665 )
by Ferry
04:29
created
src/controllers/FileController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $fullStoragePath = storage_path('app/'.$fullFilePath);
35 35
         $lifetime = 31556926; // One year in seconds
36 36
 
37
-        if (! Storage::exists($fullFilePath)) {
37
+        if (!Storage::exists($fullFilePath)) {
38 38
             abort(404);
39 39
         }
40 40
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
                 $h = Request::get('h') ?: $w;
56 56
             }
57 57
 
58
-            $imgRaw = Image::cache(function ($image) use ($fullStoragePath, $w, $h) {
58
+            $imgRaw = Image::cache(function($image) use ($fullStoragePath, $w, $h) {
59 59
                 $im = $image->make($fullStoragePath);
60 60
                 if ($w) {
61
-                    if (! $h) {
61
+                    if (!$h) {
62 62
                         $im->fit($w);
63 63
                     } else {
64 64
                         $im->fit($w, $h);
Please login to merge, or discard this patch.
src/controllers/AdminProfileController.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
                 $data['photo'] = cb()->uploadFile('photo', true, 200, 200);
32 32
             }
33 33
             DB::table("users")->where("id", auth()->id())->update($data);
34
-        }catch (\Exception $e) {
34
+        } catch (\Exception $e) {
35 35
             Log::error($e);
36 36
             return cb()->redirectBack("Something went wrong!","warning");
37 37
         }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
     public function getIndex() {
12 12
         $data = [];
13 13
         $data['page_title'] = 'Profile';
14
-        return view('crudbooster::profile',$data);
14
+        return view('crudbooster::profile', $data);
15 15
     }
16 16
 
17 17
     public function postUpdate() {
18
-        validator(request()->all(),[
18
+        validator(request()->all(), [
19 19
             'name'=>'required|max:255|min:3',
20 20
             'email'=>'required|email',
21 21
             'photo'=>'image',
@@ -26,19 +26,19 @@  discard block
 block discarded – undo
26 26
             $data = [];
27 27
             $data['name'] = request('name');
28 28
             $data['email'] = request('email');
29
-            if(request('password')) {
29
+            if (request('password')) {
30 30
                 $data['password'] = Hash::make(request('password'));
31 31
             }
32
-            if(request()->hasFile('photo')) {
32
+            if (request()->hasFile('photo')) {
33 33
                 $data['photo'] = cb()->uploadFile('photo', true, 200, 200);
34 34
             }
35 35
             DB::table("users")->where("id", auth()->id())->update($data);
36
-        }catch (\Exception $e) {
36
+        } catch (\Exception $e) {
37 37
             Log::error($e);
38
-            return cb()->redirectBack("Something went wrong!","warning");
38
+            return cb()->redirectBack("Something went wrong!", "warning");
39 39
         }
40 40
 
41
-        return cb()->redirectBack("The profile data has been updated!","success");
41
+        return cb()->redirectBack("The profile data has been updated!", "success");
42 42
     }
43 43
 
44 44
 }
Please login to merge, or discard this patch.
src/helpers/Helper.php 3 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -118,49 +118,49 @@  discard block
 block discarded – undo
118 118
 }
119 119
 
120 120
 if(!function_exists('assetThumbnail')) {
121
-	function assetThumbnail($path) {
122
-		$path = str_replace('uploads/','uploads_thumbnail/',$path);
123
-		return asset($path);
124
-	}
121
+    function assetThumbnail($path) {
122
+        $path = str_replace('uploads/','uploads_thumbnail/',$path);
123
+        return asset($path);
124
+    }
125 125
 }
126 126
 
127 127
 if(!function_exists('assetResize')) {
128
-	function assetResize($path,$width,$height=null,$quality=70) {
129
-		$basename = basename($path);
130
-	    $pathWithoutName = str_replace($basename, '', $path);
131
-	    $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
132
-	    if(Storage::exists($newLocation)) {
133
-	        return asset($newLocation);
134
-	    }else{
135
-	        $img = Image::make(storage_path($path))->fit($width,$height);
136
-	        $img->save(storage_path($newLocation),$quality);
137
-	        return asset($newLocation);
138
-	    }
139
-	}
128
+    function assetResize($path,$width,$height=null,$quality=70) {
129
+        $basename = basename($path);
130
+        $pathWithoutName = str_replace($basename, '', $path);
131
+        $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
132
+        if(Storage::exists($newLocation)) {
133
+            return asset($newLocation);
134
+        }else{
135
+            $img = Image::make(storage_path($path))->fit($width,$height);
136
+            $img->save(storage_path($newLocation),$quality);
137
+            return asset($newLocation);
138
+        }
139
+    }
140 140
 }
141 141
 
142 142
 if(!function_exists('extract_unit')) {	
143
-	/*
143
+    /*
144 144
 	Credits: Bit Repository
145 145
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
146 146
 	*/
147
-	function extract_unit($string, $start, $end)
148
-	{
149
-	$pos = stripos($string, $start);
150
-	$str = substr($string, $pos);
151
-	$str_two = substr($str, strlen($start));
152
-	$second_pos = stripos($str_two, $end);
153
-	$str_three = substr($str_two, 0, $second_pos);
154
-	$unit = trim($str_three); // remove whitespaces
155
-	return $unit;
156
-	}
147
+    function extract_unit($string, $start, $end)
148
+    {
149
+    $pos = stripos($string, $start);
150
+    $str = substr($string, $pos);
151
+    $str_two = substr($str, strlen($start));
152
+    $second_pos = stripos($str_two, $end);
153
+    $str_three = substr($str_two, 0, $second_pos);
154
+    $unit = trim($str_three); // remove whitespaces
155
+    return $unit;
156
+    }
157 157
 }
158 158
 
159 159
 
160 160
 if(!function_exists('now')) {
161
-	function now() {		
162
-		return date('Y-m-d H:i:s');
163
-	}
161
+    function now() {		
162
+        return date('Y-m-d H:i:s');
163
+    }
164 164
 }
165 165
 
166 166
 /* 
@@ -324,22 +324,22 @@  discard block
 block discarded – undo
324 324
 }
325 325
 
326 326
 if(!function_exists('rrmdir')) {
327
-	/*
327
+    /*
328 328
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
329 329
 	*/
330
-	function rrmdir($dir) { 
331
-	   if (is_dir($dir)) { 
332
-	     $objects = scandir($dir); 
333
-	     foreach ($objects as $object) { 
334
-	       if ($object != "." && $object != "..") { 
335
-	         if (is_dir($dir."/".$object))
336
-	           rrmdir($dir."/".$object);
337
-	         else
338
-	           unlink($dir."/".$object); 
339
-	       } 
340
-	     }
341
-	     rmdir($dir); 
342
-	   } 
343
-	 }
330
+    function rrmdir($dir) { 
331
+        if (is_dir($dir)) { 
332
+            $objects = scandir($dir); 
333
+            foreach ($objects as $object) { 
334
+            if ($object != "." && $object != "..") { 
335
+                if (is_dir($dir."/".$object))
336
+                rrmdir($dir."/".$object);
337
+                else
338
+                unlink($dir."/".$object); 
339
+            } 
340
+            }
341
+            rmdir($dir); 
342
+        } 
343
+        }
344 344
 }
345 345
 
Please login to merge, or discard this 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,14 +216,14 @@  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 = decrypt($settings);
225 225
             $settings = unserialize($settings);
226
-        }else{
226
+        } else {
227 227
             $settings = [];
228 228
         }
229 229
 
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
     }
236 236
 }
237 237
 
238
-if(!function_exists('getSetting')) {
238
+if (!function_exists('getSetting')) {
239 239
     function getSetting($key, $default = null)
240 240
     {
241
-        if(file_exists(storage_path('.cbconfig'))) {
241
+        if (file_exists(storage_path('.cbconfig'))) {
242 242
             $settings = file_get_contents(storage_path('.cbconfig'));
243 243
             $settings = decrypt($settings);
244 244
             $settings = unserialize($settings);
245
-        }else{
245
+        } else {
246 246
             $settings = [];
247 247
         }
248 248
 
249
-        if(isset($settings[$key])) {
250
-            return $settings[$key]?:$default;
251
-        }else{
249
+        if (isset($settings[$key])) {
250
+            return $settings[$key] ?: $default;
251
+        } else {
252 252
             return $default;
253 253
         }
254 254
     }
255 255
 }
256 256
 
257
-if(!function_exists('timeAgo')) {
257
+if (!function_exists('timeAgo')) {
258 258
     function timeAgo($datetime_to, $datetime_from = null, $full = false)
259 259
     {
260 260
         $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             }
286 286
         }
287 287
 
288
-        if (! $full) {
288
+        if (!$full) {
289 289
             $string = array_slice($string, 0, 1);
290 290
         }
291 291
 
@@ -293,22 +293,22 @@  discard block
 block discarded – undo
293 293
     }
294 294
 }
295 295
 
296
-if(!function_exists("array_map_r")) {
297
-    function array_map_r( $func, $arr )
296
+if (!function_exists("array_map_r")) {
297
+    function array_map_r($func, $arr)
298 298
     {
299 299
         $newArr = array();
300 300
 
301
-        foreach( $arr as $key => $value )
301
+        foreach ($arr as $key => $value)
302 302
         {
303 303
             $key = $func($key);
304
-            $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) );
304
+            $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value)));
305 305
         }
306 306
 
307 307
         return $newArr;
308 308
     }
309 309
 }
310 310
 
311
-if(!function_exists("sanitizeXSS"))
311
+if (!function_exists("sanitizeXSS"))
312 312
 {
313 313
     function sanitizeXSS($value)
314 314
     {
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     }
321 321
 }
322 322
 
323
-if(!function_exists("requestAll")) {
323
+if (!function_exists("requestAll")) {
324 324
     function requestAll() {
325 325
         $all = array_map_r("sanitizeXSS", request()->all());
326 326
         return $all;
@@ -329,22 +329,22 @@  discard block
 block discarded – undo
329 329
 
330 330
 
331 331
 
332
-if(!function_exists('getURLFormat')) {
332
+if (!function_exists('getURLFormat')) {
333 333
     function getURLFormat($name) {
334 334
         $url = request($name);
335
-        if(filter_var($url, FILTER_VALIDATE_URL)) {
335
+        if (filter_var($url, FILTER_VALIDATE_URL)) {
336 336
             return $url;
337
-        }else{
337
+        } else {
338 338
             return request()->url();
339 339
         }
340 340
     }
341 341
 }
342 342
 
343
-if(!function_exists('g')) {
343
+if (!function_exists('g')) {
344 344
     function g($name, $safe = true) {
345
-        if($safe == true) {
345
+        if ($safe == true) {
346 346
             $response = request($name);
347
-            if(is_string($response)) {
347
+            if (is_string($response)) {
348 348
                 $response = sanitizeXSS($response);
349 349
             }elseif (is_array($response)) {
350 350
                 array_walk_recursive($response, function(&$response) {
@@ -353,25 +353,25 @@  discard block
 block discarded – undo
353 353
             }
354 354
 
355 355
             return $response;
356
-        }else{
356
+        } else {
357 357
             return Request::get($name);
358 358
         }
359 359
     }
360 360
 }
361 361
 
362
-if(!function_exists('min_var_export')) {
362
+if (!function_exists('min_var_export')) {
363 363
     function min_var_export($input) {
364
-        if(is_array($input)) {
364
+        if (is_array($input)) {
365 365
             $buffer = [];
366
-            foreach($input as $key => $value)
366
+            foreach ($input as $key => $value)
367 367
                 $buffer[] = var_export($key, true)."=>".min_var_export($value);
368
-            return "[".implode(",",$buffer)."]";
368
+            return "[".implode(",", $buffer)."]";
369 369
         } else
370 370
             return var_export($input, true);
371 371
     }
372 372
 }
373 373
 
374
-if(!function_exists('rrmdir')) {
374
+if (!function_exists('rrmdir')) {
375 375
 	/*
376 376
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
377 377
 	*/
Please login to merge, or discard this patch.
Braces   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	    $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
177 177
 	    if(Storage::exists($newLocation)) {
178 178
 	        return asset($newLocation);
179
-	    }else{
179
+	    } else{
180 180
 	        $img = Image::make(storage_path($path))->fit($width,$height);
181 181
 	        $img->save(storage_path($newLocation),$quality);
182 182
 	        return asset($newLocation);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             $settings = file_get_contents(storage_path('.cbconfig'));
224 224
             $settings = decrypt($settings);
225 225
             $settings = unserialize($settings);
226
-        }else{
226
+        } else{
227 227
             $settings = [];
228 228
         }
229 229
 
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
             $settings = file_get_contents(storage_path('.cbconfig'));
243 243
             $settings = decrypt($settings);
244 244
             $settings = unserialize($settings);
245
-        }else{
245
+        } else{
246 246
             $settings = [];
247 247
         }
248 248
 
249 249
         if(isset($settings[$key])) {
250 250
             return $settings[$key]?:$default;
251
-        }else{
251
+        } else{
252 252
             return $default;
253 253
         }
254 254
     }
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         $url = request($name);
335 335
         if(filter_var($url, FILTER_VALIDATE_URL)) {
336 336
             return $url;
337
-        }else{
337
+        } else{
338 338
             return request()->url();
339 339
         }
340 340
     }
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
             $response = request($name);
347 347
             if(is_string($response)) {
348 348
                 $response = sanitizeXSS($response);
349
-            }elseif (is_array($response)) {
349
+            } elseif (is_array($response)) {
350 350
                 array_walk_recursive($response, function(&$response) {
351 351
                     $response = sanitizeXSS($response);
352 352
                 });
353 353
             }
354 354
 
355 355
             return $response;
356
-        }else{
356
+        } else{
357 357
             return Request::get($name);
358 358
         }
359 359
     }
@@ -363,11 +363,13 @@  discard block
 block discarded – undo
363 363
     function min_var_export($input) {
364 364
         if(is_array($input)) {
365 365
             $buffer = [];
366
-            foreach($input as $key => $value)
367
-                $buffer[] = var_export($key, true)."=>".min_var_export($value);
366
+            foreach($input as $key => $value) {
367
+                            $buffer[] = var_export($key, true)."=>".min_var_export($value);
368
+            }
368 369
             return "[".implode(",",$buffer)."]";
369
-        } else
370
-            return var_export($input, true);
370
+        } else {
371
+                    return var_export($input, true);
372
+        }
371 373
     }
372 374
 }
373 375
 
@@ -380,10 +382,11 @@  discard block
 block discarded – undo
380 382
 	     $objects = scandir($dir); 
381 383
 	     foreach ($objects as $object) { 
382 384
 	       if ($object != "." && $object != "..") { 
383
-	         if (is_dir($dir."/".$object))
384
-	           rrmdir($dir."/".$object);
385
-	         else
386
-	           unlink($dir."/".$object); 
385
+	         if (is_dir($dir."/".$object)) {
386
+	         	           rrmdir($dir."/".$object);
387
+	         } else {
388
+	         	           unlink($dir."/".$object);
389
+	         }
387 390
 	       } 
388 391
 	     }
389 392
 	     rmdir($dir); 
Please login to merge, or discard this patch.
src/helpers/MailHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     }
42 42
 
43 43
     public function send() {
44
-        Mail::send("crudbooster::emails.blank", ['content' => $this->content], function ($message) {
44
+        Mail::send("crudbooster::emails.blank", ['content' => $this->content], function($message) {
45 45
             $message->priority(1);
46 46
             $message->to($this->to_email);
47 47
             $message->from($this->sender_email, $this->sender_name);
Please login to merge, or discard this patch.
src/helpers/CB.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
                 } else {
104 104
                     throw new \Exception("Something went wrong, file can't upload!");
105 105
                 }
106
-            }else{
106
+            } else{
107 107
                 throw new \Exception("The file format is not allowed!");
108 108
             }
109 109
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 {
19 19
 
20 20
     public function getRoleByName($roleName) {
21
-        return $this->find("cb_roles",['name'=>$roleName]);
21
+        return $this->find("cb_roles", ['name'=>$roleName]);
22 22
     }
23 23
 
24 24
     public function fcm() {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     }
35 35
 
36 36
     public function getDeveloperUrl($path = null) {
37
-        $path = ($path)?"/".trim($path,"/"):null;
37
+        $path = ($path) ? "/".trim($path, "/") : null;
38 38
         return url("developer/".getSetting("developer_path")).$path;
39 39
     }
40 40
 
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     public function getAdminUrl($path = null) {
54
-        $path = ($path)?"/".trim($path,"/"):null;
54
+        $path = ($path) ? "/".trim($path, "/") : null;
55 55
         return url(cbConfig("ADMIN_PATH")).$path;
56 56
     }
57 57
 
58 58
     public function getAppName() {
59
-        return env("APP_NAME","CRUDBOOSTER");
59
+        return env("APP_NAME", "CRUDBOOSTER");
60 60
     }
61 61
 
62 62
     /**
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $fileData = base64_decode($value);
69 69
         $mime_type = finfo_buffer(finfo_open(), $fileData, FILEINFO_MIME_TYPE);
70
-        if($mime_type) {
71
-            if($mime_type = explode('/', $mime_type)) {
70
+        if ($mime_type) {
71
+            if ($mime_type = explode('/', $mime_type)) {
72 72
                 $ext = $mime_type[1];
73
-                if($ext) {
73
+                if ($ext) {
74 74
                     $filePath = 'uploads/'.date('Y-m');
75 75
                     Storage::makeDirectory($filePath);
76 76
                     $filename = sha1(strRandom(5)).'.'.$ext;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
             $file = request()->file($name);
100 100
             $ext = strtolower($file->getClientOriginalExtension());
101
-            if(in_array($ext,cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
101
+            if (in_array($ext, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
102 102
                 $filename = slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME));
103 103
                 $file_path = 'uploads/'.date('Y-m');
104 104
 
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
                 }
113 113
 
114 114
                 if (Storage::putFileAs($file_path, $file, $filename)) {
115
-                    if($resize_width || $resize_height) {
115
+                    if ($resize_width || $resize_height) {
116 116
                         $this->resizeImage($file_path.'/'.$filename, $resize_width, $resize_height);
117 117
                     }
118 118
                     return $file_path.'/'.$filename;
119 119
                 } else {
120 120
                     throw new \Exception("Something went wrong, file can't upload!");
121 121
                 }
122
-            }else{
122
+            } else {
123 123
                 throw new \Exception("The file format is not allowed!");
124 124
             }
125 125
 
@@ -142,22 +142,22 @@  discard block
 block discarded – undo
142 142
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
143 143
                 $img->fit($resize_width, $resize_height);
144 144
                 $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty);
145
-            } elseif ($resize_width && ! $resize_height) {
145
+            } elseif ($resize_width && !$resize_height) {
146 146
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
147
-                $img->resize($resize_width, null, function ($constraint) {
147
+                $img->resize($resize_width, null, function($constraint) {
148 148
                     $constraint->aspectRatio();
149 149
                 });
150 150
                 $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty);
151
-            } elseif (! $resize_width && $resize_height) {
151
+            } elseif (!$resize_width && $resize_height) {
152 152
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
153
-                $img->resize(null, $resize_height, function ($constraint) {
153
+                $img->resize(null, $resize_height, function($constraint) {
154 154
                     $constraint->aspectRatio();
155 155
                 });
156 156
                 $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty);
157 157
             } else {
158 158
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
159 159
                 if ($img->width() > 1300) {
160
-                    $img->resize(1300, null, function ($constraint) {
160
+                    $img->resize(1300, null, function($constraint) {
161 161
                         $constraint->aspectRatio();
162 162
                     });
163 163
                 }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         $validator = Validator::make($input_arr, $rules, $messages);
275 275
         if ($validator->fails()) {
276 276
             $message = $validator->errors()->all();
277
-            throw new CBValidationException(implode("; ",$message));
277
+            throw new CBValidationException(implode("; ", $message));
278 278
         }
279 279
     }
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     public function findPrimaryKey($table)
287 287
     {
288 288
         $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey();
289
-        if(!$pk) {
289
+        if (!$pk) {
290 290
             return null;
291 291
         }
292 292
         return $pk->getColumns()[0];
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $string_parameters_array = explode('&', $string_parameters);
336 336
             foreach ($string_parameters_array as $s) {
337 337
                 $part = explode('=', $s);
338
-                if(isset($part[0]) && isset($part[1])) {
338
+                if (isset($part[0]) && isset($part[1])) {
339 339
                     $name = htmlspecialchars(urldecode($part[0]));
340 340
                     $name = strip_tags($name);
341 341
                     $value = htmlspecialchars(urldecode($part[1]));
@@ -352,16 +352,16 @@  discard block
 block discarded – undo
352 352
 
353 353
 
354 354
     public function routeGet($prefix, $controller) {
355
-        $alias = str_replace("@"," ", $controller);
355
+        $alias = str_replace("@", " ", $controller);
356 356
         $alias = ucwords($alias);
357
-        $alias = str_replace(" ","",$alias);
357
+        $alias = str_replace(" ", "", $alias);
358 358
         Route::get($prefix, ['uses' => $controller, 'as' => $alias]);
359 359
     }
360 360
 
361 361
     public function routePost($prefix, $controller) {
362
-        $alias = str_replace("@"," ", $controller);
362
+        $alias = str_replace("@", " ", $controller);
363 363
         $alias = ucwords($alias);
364
-        $alias = str_replace(" ","",$alias);
364
+        $alias = str_replace(" ", "", $alias);
365 365
         Route::post($prefix, ['uses' => $controller, 'as' => $alias]);
366 366
     }
367 367
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
         $prefix = trim($prefix, '/').'/';
388 388
 
389
-        if(substr($controller,0,1) != "\\") {
389
+        if (substr($controller, 0, 1) != "\\") {
390 390
             $controller = "\App\Http\Controllers\\".$controller;
391 391
         }
392 392
 
Please login to merge, or discard this patch.
src/commands/Install.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
         if ($this->confirm('Do you have setting the database configuration at .env ?')) {
40 40
 
41
-            if (! file_exists(public_path('vendor')) ) {
41
+            if (!file_exists(public_path('vendor'))) {
42 42
                 mkdir(public_path('vendor'), 0777);
43 43
             }
44 44
 
Please login to merge, or discard this patch.
src/types/checkbox/CheckboxHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 class CheckboxHelper
12 12
 {
13 13
     public static function parseValuesToArray($values) {
14
-        $data = explode(";",$values);
14
+        $data = explode(";", $values);
15 15
         return $data;
16 16
     }
17 17
     
Please login to merge, or discard this patch.
src/validations/validation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php 
2 2
 
3
-\Validator::extend('alpha_spaces', function ($attribute, $value) {
3
+\Validator::extend('alpha_spaces', function($attribute, $value) {
4 4
     // This will only accept alpha and spaces. 
5 5
     // If you want to accept hyphens use: /^[\pL\s-]+$/u.
6 6
     return preg_match('/^[\pL\s]+$/u', $value); 
7 7
 },'The :attribute should be letters and spaces only');
8 8
 
9
-\Validator::extend('alpha_num_spaces', function ($attribute, $value) {
9
+\Validator::extend('alpha_num_spaces', function($attribute, $value) {
10 10
     // This will only accept alphanumeric and spaces. 
11 11
     return preg_match('/^[a-zA-Z0-9\s]+$/', $value); 
12 12
 },'The :attribute should be alphanumeric characters and spaces only');
13 13
\ No newline at end of file
Please login to merge, or discard this patch.
src/middlewares/CBDeveloper.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
     public function handle($request, Closure $next)
19 19
     {
20 20
 
21
-        if(!session()->has("developer")) {
22
-            return cb()->redirect(cb()->getDeveloperUrl("login"),"Please login for first");
21
+        if (!session()->has("developer")) {
22
+            return cb()->redirect(cb()->getDeveloperUrl("login"), "Please login for first");
23 23
         }
24 24
 
25 25
         return $next($request);
Please login to merge, or discard this patch.