Completed
Push — master ( 7f1e16...35a352 )
by CodexShaper
05:06
created
routes/apiBackup.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-Route::group(['prefix' => config('dbm.prefix'), 'namespace' => config('dbm.controller_namespace')], function () {
3
+Route::group(['prefix' => config('dbm.prefix'), 'namespace' => config('dbm.controller_namespace')], function() {
4 4
 
5 5
     /* Helpers Route*/
6 6
     Route::get('assets', 'ManagerController@assets')->name('dbm.asset');
7 7
 
8 8
     // Database
9
-    Route::group(['prefix' => 'database', 'middleware' => 'auth:api'], function () {
9
+    Route::group(['prefix' => 'database', 'middleware' => 'auth:api'], function() {
10 10
 
11 11
         // Route::get('/', 'DatabaseController@index')->name('dbm.table');
12 12
         Route::get('/tables', 'DatabaseController@all');
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * U = Update/Edit
44 44
      * D = Delete
45 45
      */
46
-    Route::group(['prefix' => 'crud', 'middleware' => 'auth:api'], function () {
46
+    Route::group(['prefix' => 'crud', 'middleware' => 'auth:api'], function() {
47 47
 
48 48
         // Route::get('/', 'CrudController@index')->name('dbm.crud');
49 49
         Route::get('/tables', 'CrudController@all');
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
     });
62 62
 
63
-    Route::group(['prefix' => 'table', 'middleware' => 'auth:api'], function () {
63
+    Route::group(['prefix' => 'table', 'middleware' => 'auth:api'], function() {
64 64
 
65 65
         // Builder
66 66
         // Route::get('/builder/{name}', 'DatabaseController@showTableBuilder');
Please login to merge, or discard this patch.
src/Database/Schema/ForeignKey.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@
 block discarded – undo
53 53
 
54 54
     public static function createName(array $columns, $type, $table = null)
55 55
     {
56
-        $table = isset($table) ? trim($table) . '_' : '';
56
+        $table = isset($table) ? trim($table).'_' : '';
57 57
         $type  = trim($type);
58
-        $name  = strtolower($table . implode('_', $columns) . '_' . $type);
58
+        $name  = strtolower($table.implode('_', $columns).'_'.$type);
59 59
 
60 60
         return str_replace(['-', '.'], '_', $name);
61 61
     }
Please login to merge, or discard this patch.
src/Http/Controllers/DatabaseController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                 'name'          => $column['name']])->first()) {
283 283
                 return response()->json([
284 284
                     'success' => false,
285
-                    'errors'  => ["Field name must be unique. " . $column['name'] . " are duplicate"],
285
+                    'errors'  => ["Field name must be unique. ".$column['name']." are duplicate"],
286 286
                 ], 400);
287 287
             }
288 288
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
             if (DBM::Template()->where('name', $field['name'])->first()) {
541 541
                 return response()->json([
542 542
                     'success' => false,
543
-                    'errors'  => [" The template name must be unique. " . $field['name'] . " already exist."],
543
+                    'errors'  => [" The template name must be unique. ".$field['name']." already exist."],
544 544
                 ], 400);
545 545
             }
546 546
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
         }
578 578
         return response()->json([
579 579
             'success' => false,
580
-            'errors'  => ['The template '+$request->name . " not found"],
580
+            'errors'  => ['The template '+$request->name." not found"],
581 581
         ], 400);
582 582
     }
583 583
 
Please login to merge, or discard this patch.
src/Commands/DatabaseBackup.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
      */
45 45
     protected function findComposer()
46 46
     {
47
-        if (file_exists(getcwd() . '/composer.phar')) {
48
-            return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar';
47
+        if (file_exists(getcwd().'/composer.phar')) {
48
+            return '"'.PHP_BINARY.'" '.getcwd().'/composer.phar';
49 49
         }
50 50
         return 'composer';
51 51
     }
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
     {
55 55
 
56 56
         $prefix = (strlen($table) > 0)
57
-        ? 'table_' . strtolower(str_replace('-', '_', $table)) . "_"
58
-        : 'database_' . strtolower(str_replace('-', '_', $database)) . "_";
57
+        ? 'table_'.strtolower(str_replace('-', '_', $table))."_"
58
+        : 'database_'.strtolower(str_replace('-', '_', $database))."_";
59 59
 
60 60
         $extension = Driver::isMongoDB() ? '' : '.sql';
61
-        $fileName  = $prefix . 'backup_' . date('G_a_m_d_y_h_i_s') . $extension;
61
+        $fileName  = $prefix.'backup_'.date('G_a_m_d_y_h_i_s').$extension;
62 62
 
63 63
         if (Driver::isSqlite()) {
64
-            $fileName = 'backup_' . date('G_a_m_d_y_h_i_s') . $extension;
64
+            $fileName = 'backup_'.date('G_a_m_d_y_h_i_s').$extension;
65 65
         }
66 66
 
67 67
         return $fileName;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $compressBinaryPath = config('dbm.backup.compress_binary_path', "");
75 75
         $compressCommand    = config('dbm.backup.compress_command', "gzip");
76 76
         $compressExtension  = config('dbm.backup.compress_extension', ".gz");
77
-        $dumpBinaryPath     = config('dbm.backup.' . $data['driver'] . '.binary_path', '');
77
+        $dumpBinaryPath     = config('dbm.backup.'.$data['driver'].'.binary_path', '');
78 78
 
79 79
         switch ($data['driver']) {
80 80
             case 'mysql':
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         // $hostname = config('database.connections.' . $driver . '.host', '127.0.0.1');
122 122
         // $port     = config('database.connections.' . $driver . '.port', '3306');
123
-        $database = config('database.connections.' . $driver . '.database', 'dbm');
123
+        $database = config('database.connections.'.$driver.'.database', 'dbm');
124 124
         $table    = ($this->option('table') != null) ? $this->option('table') : '';
125 125
         // $username = config('database.connections.' . $driver . '.username', 'root');
126 126
         // $password = config('database.connections.' . $driver . '.password', '');
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
             $directory = (config('dbm.backup.dir', 'backups') != '')
131 131
             ? DIRECTORY_SEPARATOR . config('dbm.backup.dir', 'backups')
132 132
             : '';
133
-            $directoryPath = DBM::getPathPrefix() . $directory . DIRECTORY_SEPARATOR . $driver;
134
-            $filePath      = $directoryPath . DIRECTORY_SEPARATOR . $this->getFileName($table, $database);
133
+            $directoryPath = DBM::getPathPrefix().$directory.DIRECTORY_SEPARATOR.$driver;
134
+            $filePath      = $directoryPath.DIRECTORY_SEPARATOR.$this->getFileName($table, $database);
135 135
 
136 136
             if (!File::isDirectory($directoryPath)) {
137 137
 
Please login to merge, or discard this patch.
src/Http/Controllers/CrudController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
                         $modelName = ucfirst(Str::singular($object->name));
95 95
 
96
-                        $model         = $namespace . '\\' . $modelName;
96
+                        $model         = $namespace.'\\'.$modelName;
97 97
                         $object->model = $model;
98 98
                     }
99 99
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                     $table = Table::getTable($tableName);
106 106
 
107 107
                     $modelName = ucfirst(Str::singular($table['name']));
108
-                    $model     = $namespace . '\\' . $modelName;
108
+                    $model     = $namespace.'\\'.$modelName;
109 109
 
110 110
                     $object               = new \stdClass;
111 111
                     $object->name         = $table['name'];
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         if ($table['makeModel'] == true && !class_exists($table['model'])) {
235 235
             \DBM::makeModel($table['model'], $table['name']);
236 236
         } else if ($table['makeModel'] == false && !class_exists($table['model'])) {
237
-            $error = "Create model '" . $table['model'] . "' first or checked create model option";
237
+            $error = "Create model '".$table['model']."' first or checked create model option";
238 238
             return $this->generateError([$error]);
239 239
         }
240 240
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             // $action     = ($request->isCrudExists) ? 'edit' : 'add';
255 255
             $permission = $request->isCrudExists ? 'update' : 'create';
256 256
 
257
-            if (($response = DBM::authorize('crud.' . $permission)) !== true) {
257
+            if (($response = DBM::authorize('crud.'.$permission)) !== true) {
258 258
                 return $response;
259 259
             }
260 260
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
             $prefix = (Driver::isMongoDB()) ? "_" : "";
327 327
 
328 328
             foreach ($fields as $fld) {
329
-                if ($fld->id == $field->{$prefix . "id"}) {
329
+                if ($fld->id == $field->{$prefix."id"}) {
330 330
 
331 331
                     $relationship = $fld->settings;
332 332
                     $localTable   = $relationship['localTable'];
@@ -360,17 +360,17 @@  discard block
 block discarded – undo
360 360
 
361 361
             if (!class_exists($relationship['localModel'])) {
362 362
 
363
-                $error = $relationship['localModel'] . " Model not found. Please create the " . $relationship['localModel'] . " model first";
363
+                $error = $relationship['localModel']." Model not found. Please create the ".$relationship['localModel']." model first";
364 364
                 return $this->generateError([$error]);
365 365
             }
366 366
 
367 367
             if (!class_exists($relationship['foreignModel'])) {
368 368
 
369
-                $error = $relationship['foreignModel'] . " Model not found. Please create the " . $relationship['foreignModel'] . " model first";
369
+                $error = $relationship['foreignModel']." Model not found. Please create the ".$relationship['foreignModel']." model first";
370 370
                 return $this->generateError([$error]);
371 371
             }
372 372
 
373
-            $fieldName = strtolower(Str::singular($relationship['localTable']) . '_' . $relationship['type'] . '_' . Str::singular($relationship['foreignTable']) . '_relationship');
373
+            $fieldName = strtolower(Str::singular($relationship['localTable']).'_'.$relationship['type'].'_'.Str::singular($relationship['foreignTable']).'_relationship');
374 374
             $settings  = [
375 375
                 'relationType'    => $relationship['type'],
376 376
                 'localModel'      => $relationship['localModel'],
Please login to merge, or discard this patch.