@@ -21,6 +21,6 @@ |
||
| 21 | 21 | |
| 22 | 22 | $type = $fieldDeclaration['autoincrement'] ? 'smallserial' : 'smallint'; |
| 23 | 23 | |
| 24 | - return $type . $commonIntegerTypeDeclaration; |
|
| 24 | + return $type.$commonIntegerTypeDeclaration; |
|
| 25 | 25 | } |
| 26 | 26 | } |
@@ -24,10 +24,10 @@ |
||
| 24 | 24 | $pdo = DB::connection()->getPdo(); |
| 25 | 25 | |
| 26 | 26 | // trim the values |
| 27 | - $fieldDeclaration['allowed'] = array_map(function ($value) use ($pdo) { |
|
| 27 | + $fieldDeclaration['allowed'] = array_map(function($value) use ($pdo) { |
|
| 28 | 28 | return $pdo->quote(trim($value)); |
| 29 | 29 | }, $allowed); |
| 30 | 30 | |
| 31 | - return 'set(' . implode(', ', $fieldDeclaration['allowed']) . ')'; |
|
| 31 | + return 'set('.implode(', ', $fieldDeclaration['allowed']).')'; |
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -54,13 +54,13 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | protected static function getCustomTypes($platformName) |
| 56 | 56 | { |
| 57 | - $customPlatformDir = __DIR__ . DIRECTORY_SEPARATOR . $platformName . DIRECTORY_SEPARATOR; |
|
| 57 | + $customPlatformDir = __DIR__.DIRECTORY_SEPARATOR.$platformName.DIRECTORY_SEPARATOR; |
|
| 58 | 58 | |
| 59 | 59 | $customTypes = []; |
| 60 | 60 | |
| 61 | - foreach (glob($customPlatformDir . '*.php') as $file) { |
|
| 61 | + foreach (glob($customPlatformDir.'*.php') as $file) { |
|
| 62 | 62 | $className = basename($file, ".php"); |
| 63 | - $customTypes[] = __NAMESPACE__ . '\\' . $platformName . '\\' . $className; |
|
| 63 | + $customTypes[] = __NAMESPACE__.'\\'.$platformName.'\\'.$className; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | return $customTypes; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function getNamespace($databaseName, $collectionName) |
| 73 | 73 | { |
| 74 | - return $databaseName . '.' . $collectionName; |
|
| 74 | + return $databaseName.'.'.$collectionName; |
|
| 75 | 75 | } |
| 76 | 76 | /** |
| 77 | 77 | * Get the all collections. |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $oldName = $collection['oldName']; |
| 153 | 153 | $collectionName = $oldName; |
| 154 | 154 | $connection = config('database.default'); |
| 155 | - $database = config('database.connections.' . $connection . ".database"); |
|
| 155 | + $database = config('database.connections.'.$connection.".database"); |
|
| 156 | 156 | $fromNs = $this->getNamespace($database, $oldName); |
| 157 | 157 | $toNs = $this->getNamespace($database, $newName); |
| 158 | 158 | |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | Type::registerCustomTypes(); |
| 153 | 153 | |
| 154 | - $conn = 'database.connections.' . config('database.default'); |
|
| 154 | + $conn = 'database.connections.'.config('database.default'); |
|
| 155 | 155 | |
| 156 | - $table['options']['collate'] = config($conn . '.collation', 'utf8mb4_unicode_ci'); |
|
| 157 | - $table['options']['charset'] = config($conn . '.charset', 'utf8mb4'); |
|
| 156 | + $table['options']['collate'] = config($conn.'.collation', 'utf8mb4_unicode_ci'); |
|
| 157 | + $table['options']['charset'] = config($conn.'.charset', 'utf8mb4'); |
|
| 158 | 158 | |
| 159 | 159 | $tableName = $table['name']; |
| 160 | 160 | $columns = $table['columns']; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $items = static::all(); |
| 278 | 278 | $collection = $items instanceof Collection ? $items : Collection::make($items); |
| 279 | 279 | if (!empty($query)) { |
| 280 | - $collection = $collection->filter(function ($value, $key) use ($query) { |
|
| 280 | + $collection = $collection->filter(function($value, $key) use ($query) { |
|
| 281 | 281 | return false !== stristr($value, $query); |
| 282 | 282 | }); |
| 283 | 283 | } |
@@ -68,9 +68,9 @@ |
||
| 68 | 68 | */ |
| 69 | 69 | public static function createName($columns, $type, $table = null) |
| 70 | 70 | { |
| 71 | - $table = isset($table) ? trim($table) . '_' : ''; |
|
| 71 | + $table = isset($table) ? trim($table).'_' : ''; |
|
| 72 | 72 | $type = trim($type); |
| 73 | - $name = strtolower($table . implode('_', $columns) . '_' . $type); |
|
| 73 | + $name = strtolower($table.implode('_', $columns).'_'.$type); |
|
| 74 | 74 | |
| 75 | 75 | return str_replace(['-', '.'], '_', $name); |
| 76 | 76 | } |
@@ -56,9 +56,9 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | public static function createName($columns, $type, $table = null) |
| 58 | 58 | { |
| 59 | - $table = isset($table) ? trim($table) . '_' : ''; |
|
| 59 | + $table = isset($table) ? trim($table).'_' : ''; |
|
| 60 | 60 | $type = trim($type); |
| 61 | - $name = strtolower($table . implode('_', $columns) . '_' . $type); |
|
| 61 | + $name = strtolower($table.implode('_', $columns).'_'.$type); |
|
| 62 | 62 | |
| 63 | 63 | return str_replace(['-', '.'], '_', $name); |
| 64 | 64 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public static function getPlatform($platformName) |
| 19 | 19 | { |
| 20 | - $platform = __NAMESPACE__ . '\\' . ucfirst($platformName); |
|
| 20 | + $platform = __NAMESPACE__.'\\'.ucfirst($platformName); |
|
| 21 | 21 | |
| 22 | 22 | if (!class_exists($platform)) { |
| 23 | 23 | throw new \Exception("Platform {$platformName} doesn't exist"); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function webRoutes() |
| 31 | 31 | { |
| 32 | - require __DIR__ . '/../routes/web.php'; |
|
| 32 | + require __DIR__.'/../routes/web.php'; |
|
| 33 | 33 | } |
| 34 | 34 | /** |
| 35 | 35 | * Include API routes |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function apiRoutes() |
| 40 | 40 | { |
| 41 | - require __DIR__ . '/../routes/api.php'; |
|
| 41 | + require __DIR__.'/../routes/api.php'; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function assets($path) |
| 52 | 52 | { |
| 53 | - $file = base_path(trim(config('dbm.resources_path'), '/') . "/" . urldecode($path)); |
|
| 53 | + $file = base_path(trim(config('dbm.resources_path'), '/')."/".urldecode($path)); |
|
| 54 | 54 | |
| 55 | 55 | if (File::exists($file)) { |
| 56 | 56 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function generateModelName($className) |
| 101 | 101 | { |
| 102 | - return static::getModelNamespace() . '\\' . ucfirst(Str::singular($className)); |
|
| 102 | + return static::getModelNamespace().'\\'.ucfirst(Str::singular($className)); |
|
| 103 | 103 | } |
| 104 | 104 | /** |
| 105 | 105 | * Make new model |
@@ -119,27 +119,27 @@ discard block |
||
| 119 | 119 | $namespace = implode("\\", $partials); |
| 120 | 120 | |
| 121 | 121 | $contents = "<?php\n\n"; |
| 122 | - $contents .= "namespace " . $namespace . ";\n\n"; |
|
| 122 | + $contents .= "namespace ".$namespace.";\n\n"; |
|
| 123 | 123 | if (Driver::isMongoDB()) { |
| 124 | 124 | $contents .= "use Jenssegers\Mongodb\Eloquent\Model;\n\n"; |
| 125 | 125 | } else { |
| 126 | 126 | $contents .= "use Illuminate\Database\Eloquent\Model;\n\n"; |
| 127 | 127 | } |
| 128 | - $contents .= "class " . $className . " extends Model\n"; |
|
| 128 | + $contents .= "class ".$className." extends Model\n"; |
|
| 129 | 129 | $contents .= "{\n\n"; |
| 130 | 130 | if (Driver::isMongoDB()) { |
| 131 | - $contents .= "\tprotected \$collection = '" . $table . "';\n"; |
|
| 131 | + $contents .= "\tprotected \$collection = '".$table."';\n"; |
|
| 132 | 132 | } else { |
| 133 | - $contents .= "\tprotected \$table = '" . $table . "';\n"; |
|
| 133 | + $contents .= "\tprotected \$table = '".$table."';\n"; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // $content .= "\tpublic \$timestamps = false;\n"; |
| 137 | 137 | $contents .= "}\n"; |
| 138 | 138 | |
| 139 | 139 | $filesystem = new Filesystem; |
| 140 | - $filesystem->put(base_path($model . ".php"), $contents); |
|
| 140 | + $filesystem->put(base_path($model.".php"), $contents); |
|
| 141 | 141 | } catch (\Exception $e) { |
| 142 | - throw new \Exception("There has an error when create model. The error is :" . $e->getMessage(), 1); |
|
| 142 | + throw new \Exception("There has an error when create model. The error is :".$e->getMessage(), 1); |
|
| 143 | 143 | |
| 144 | 144 | } |
| 145 | 145 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | 'name' => $controller, |
| 159 | 159 | ]); |
| 160 | 160 | } catch (\Exception $e) { |
| 161 | - throw new \Exception("There has an error when create Controller. The error is :" . $e->getMessage(), 1); |
|
| 161 | + throw new \Exception("There has an error when create Controller. The error is :".$e->getMessage(), 1); |
|
| 162 | 162 | |
| 163 | 163 | } |
| 164 | 164 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | case 'not_authorized': |
| 356 | 356 | return response()->json([ |
| 357 | 357 | 'success' => false, |
| 358 | - 'errors' => ["You don't have permission to " . $slug . " " . $prefix], |
|
| 358 | + 'errors' => ["You don't have permission to ".$slug." ".$prefix], |
|
| 359 | 359 | ], 401); |
| 360 | 360 | break; |
| 361 | 361 | case 'authorized': |