@@ -18,7 +18,7 @@ discard block |
||
| 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 |
||
| 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(cbConfig("DEV_PATH")).$path; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -51,22 +51,22 @@ discard block |
||
| 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 | public function uploadBase64($value) |
| 63 | 63 | { |
| 64 | 64 | $fileData = base64_decode($value); |
| 65 | 65 | $mime_type = finfo_buffer(finfo_open(), $fileData, FILEINFO_MIME_TYPE); |
| 66 | - if($mime_type) { |
|
| 67 | - if($mime_type = explode('/', $mime_type)) { |
|
| 66 | + if ($mime_type) { |
|
| 67 | + if ($mime_type = explode('/', $mime_type)) { |
|
| 68 | 68 | $ext = $mime_type[1]; |
| 69 | - if($ext) { |
|
| 69 | + if ($ext) { |
|
| 70 | 70 | $filePath = 'uploads/'.date('Y-m'); |
| 71 | 71 | Storage::makeDirectory($filePath); |
| 72 | 72 | $filename = sha1(strRandom(5)).'.'.$ext; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $file = request()->file($name); |
| 88 | 88 | $ext = $file->getClientOriginalExtension(); |
| 89 | - if(in_array($ext,cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) { |
|
| 89 | + if (in_array($ext, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) { |
|
| 90 | 90 | $filename = slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)); |
| 91 | 91 | $file_path = 'uploads/'.date('Y-m'); |
| 92 | 92 | |
@@ -100,14 +100,14 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | if (Storage::putFileAs($file_path, $file, $filename)) { |
| 103 | - if($resize_width || $resize_height) { |
|
| 103 | + if ($resize_width || $resize_height) { |
|
| 104 | 104 | $this->resizeImage($file_path.'/'.$filename, $resize_width, $resize_height); |
| 105 | 105 | } |
| 106 | 106 | return $file_path.'/'.$filename; |
| 107 | 107 | } else { |
| 108 | 108 | throw new \Exception("Something went wrong, file can't upload!"); |
| 109 | 109 | } |
| 110 | - }else{ |
|
| 110 | + } else { |
|
| 111 | 111 | throw new \Exception("The file format is not allowed!"); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -130,22 +130,22 @@ discard block |
||
| 130 | 130 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
| 131 | 131 | $img->fit($resize_width, $resize_height); |
| 132 | 132 | $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty); |
| 133 | - } elseif ($resize_width && ! $resize_height) { |
|
| 133 | + } elseif ($resize_width && !$resize_height) { |
|
| 134 | 134 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
| 135 | - $img->resize($resize_width, null, function ($constraint) { |
|
| 135 | + $img->resize($resize_width, null, function($constraint) { |
|
| 136 | 136 | $constraint->aspectRatio(); |
| 137 | 137 | }); |
| 138 | 138 | $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty); |
| 139 | - } elseif (! $resize_width && $resize_height) { |
|
| 139 | + } elseif (!$resize_width && $resize_height) { |
|
| 140 | 140 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
| 141 | - $img->resize(null, $resize_height, function ($constraint) { |
|
| 141 | + $img->resize(null, $resize_height, function($constraint) { |
|
| 142 | 142 | $constraint->aspectRatio(); |
| 143 | 143 | }); |
| 144 | 144 | $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty); |
| 145 | 145 | } else { |
| 146 | 146 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
| 147 | 147 | if ($img->width() > 1300) { |
| 148 | - $img->resize(1300, null, function ($constraint) { |
|
| 148 | + $img->resize(1300, null, function($constraint) { |
|
| 149 | 149 | $constraint->aspectRatio(); |
| 150 | 150 | }); |
| 151 | 151 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $validator = Validator::make($input_arr, $rules, $messages); |
| 258 | 258 | if ($validator->fails()) { |
| 259 | 259 | $message = $validator->errors()->all(); |
| 260 | - throw new CBValidationException(implode("; ",$message)); |
|
| 260 | + throw new CBValidationException(implode("; ", $message)); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | public function findPrimaryKey($table) |
| 270 | 270 | { |
| 271 | 271 | $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey(); |
| 272 | - if(!$pk) { |
|
| 272 | + if (!$pk) { |
|
| 273 | 273 | return null; |
| 274 | 274 | } |
| 275 | 275 | return $pk->getColumns()[0]; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | $string_parameters_array = explode('&', $string_parameters); |
| 319 | 319 | foreach ($string_parameters_array as $s) { |
| 320 | 320 | $part = explode('=', $s); |
| 321 | - if(isset($part[0]) && isset($part[1])) { |
|
| 321 | + if (isset($part[0]) && isset($part[1])) { |
|
| 322 | 322 | $name = htmlspecialchars(urldecode($part[0])); |
| 323 | 323 | $name = strip_tags($name); |
| 324 | 324 | $value = htmlspecialchars(urldecode($part[1])); |
@@ -335,16 +335,16 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | |
| 337 | 337 | public function routeGet($prefix, $controller) { |
| 338 | - $alias = str_replace("@"," ", $controller); |
|
| 338 | + $alias = str_replace("@", " ", $controller); |
|
| 339 | 339 | $alias = ucwords($alias); |
| 340 | - $alias = str_replace(" ","",$alias); |
|
| 340 | + $alias = str_replace(" ", "", $alias); |
|
| 341 | 341 | Route::get($prefix, ['uses' => $controller, 'as' => $alias]); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | public function routePost($prefix, $controller) { |
| 345 | - $alias = str_replace("@"," ", $controller); |
|
| 345 | + $alias = str_replace("@", " ", $controller); |
|
| 346 | 346 | $alias = ucwords($alias); |
| 347 | - $alias = str_replace(" ","",$alias); |
|
| 347 | + $alias = str_replace(" ", "", $alias); |
|
| 348 | 348 | Route::post($prefix, ['uses' => $controller, 'as' => $alias]); |
| 349 | 349 | } |
| 350 | 350 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | $prefix = trim($prefix, '/').'/'; |
| 372 | 372 | |
| 373 | - if(substr($controller,0,1) != "\\") { |
|
| 373 | + if (substr($controller, 0, 1) != "\\") { |
|
| 374 | 374 | $controller = "\App\Http\Controllers\\".$controller; |
| 375 | 375 | } |
| 376 | 376 | |