@@ -34,7 +34,7 @@ discard block |
||
| 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 |
||
| 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); |
@@ -31,7 +31,7 @@ |
||
| 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 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -41,7 +41,7 @@ |
||
| 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); |
@@ -103,7 +103,7 @@ |
||
| 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 | |
@@ -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("developer/".getSetting("developer_path")).$path; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -51,12 +51,12 @@ 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 | /** |
@@ -67,10 +67,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -38,7 +38,7 @@ |
||
| 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 | |
@@ -11,7 +11,7 @@ |
||
| 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 | |
@@ -1,12 +1,12 @@ |
||
| 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 |
@@ -18,8 +18,8 @@ |
||
| 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); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::table('users', function (Blueprint $table) { |
|
| 15 | + Schema::table('users', function(Blueprint $table) { |
|
| 16 | 16 | $table->string('photo')->nullable(); |
| 17 | 17 | $table->integer('cb_roles_id'); |
| 18 | 18 | }); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function down() |
| 27 | 27 | { |
| 28 | - Schema::table('users', function (Blueprint $table) { |
|
| 28 | + Schema::table('users', function(Blueprint $table) { |
|
| 29 | 29 | $table->dropColumn('cb_roles_id'); |
| 30 | 30 | $table->dropColumn('photo'); |
| 31 | 31 | }); |