@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | public function executeIndexCommand($command) |
| 151 | 151 | { |
| 152 | 152 | if ($this->connection->pretending()) { |
| 153 | - $this->connection->logQuery('/* ' . $command->explanation . " */\n", []); |
|
| 153 | + $this->connection->logQuery('/* '.$command->explanation." */\n", []); |
|
| 154 | 154 | |
| 155 | 155 | return; |
| 156 | 156 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | $parameters['name'] = 'dropIndex'; |
| 181 | 181 | $parameters['index'] = $name; |
| 182 | - $parameters['explanation'] = "Drop the '" . $name . "' index on the {$this->table} table."; |
|
| 182 | + $parameters['explanation'] = "Drop the '".$name."' index on the {$this->table} table."; |
|
| 183 | 183 | $parameters['handler'] = 'collection'; |
| 184 | 184 | |
| 185 | 185 | return $this->addCommand('dropIndex', $parameters); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | public function executeDropIndexCommand($command) |
| 194 | 194 | { |
| 195 | 195 | if ($this->connection->pretending()) { |
| 196 | - $this->connection->logQuery('/* ' . $command->explanation . " */\n", []); |
|
| 196 | + $this->connection->logQuery('/* '.$command->explanation." */\n", []); |
|
| 197 | 197 | |
| 198 | 198 | return; |
| 199 | 199 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | public function createIndexName($type, array $columns) |
| 228 | 228 | { |
| 229 | - $index = strtolower($this->prefix . $this->table . '_' . implode('_', $columns) . '_' . $type); |
|
| 229 | + $index = strtolower($this->prefix.$this->table.'_'.implode('_', $columns).'_'.$type); |
|
| 230 | 230 | $index = preg_replace("/\[\*+\]+/", '_array', $index); |
| 231 | 231 | |
| 232 | 232 | return preg_replace('/[^A-Za-z0-9]+/', '_', $index); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $parameters = []; |
| 18 | 18 | $parameters['handler'] = 'aql'; |
| 19 | - $parameters['explanation'] = "Checking if any document within the table has the '" . implode(', ', (array) $column) . "' column(s)."; |
|
| 19 | + $parameters['explanation'] = "Checking if any document within the table has the '".implode(', ', (array) $column)."' column(s)."; |
|
| 20 | 20 | $parameters['column'] = $column; |
| 21 | 21 | |
| 22 | 22 | return $this->addCommand('hasAttribute', $parameters); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $parameters = []; |
| 54 | 54 | $parameters['handler'] = 'aql'; |
| 55 | 55 | $parameters['attributes'] = $columns; |
| 56 | - $parameters['explanation'] = 'Drop the following column(s): ' . implode(',', $columns) . '.'; |
|
| 56 | + $parameters['explanation'] = 'Drop the following column(s): '.implode(',', $columns).'.'; |
|
| 57 | 57 | |
| 58 | 58 | return $this->addCommand('dropAttribute', compact('parameters')); |
| 59 | 59 | } |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $filter = []; |
| 34 | 34 | foreach ($command->attribute as $attribute) { |
| 35 | - $filter[] = ['doc.' . $attribute, '!=', 'null']; |
|
| 35 | + $filter[] = ['doc.'.$attribute, '!=', 'null']; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $aqb = AQB::for('doc', $collection) |
|
| 38 | + $aqb = AQB::for ('doc', $collection) |
|
| 39 | 39 | ->filter($filter) |
| 40 | 40 | ->limit(1) |
| 41 | 41 | ->return('true') |
@@ -61,17 +61,17 @@ discard block |
||
| 61 | 61 | $bindings['to'] = $this->wrapBindVar($command->from); |
| 62 | 62 | |
| 63 | 63 | $filter = [ |
| 64 | - ['doc.' . $command->from, '!=', 'null'], |
|
| 65 | - ['doc.' . $command->to], |
|
| 64 | + ['doc.'.$command->from, '!=', 'null'], |
|
| 65 | + ['doc.'.$command->to], |
|
| 66 | 66 | ]; |
| 67 | 67 | |
| 68 | - $aqb = AQB::for('doc', $collection) |
|
| 68 | + $aqb = AQB::for ('doc', $collection) |
|
| 69 | 69 | ->filter($filter) |
| 70 | 70 | ->update( |
| 71 | 71 | 'doc', |
| 72 | 72 | [ |
| 73 | 73 | $command->from => 'null', |
| 74 | - $command->to => 'doc.' . $command->from, |
|
| 74 | + $command->to => 'doc.'.$command->from, |
|
| 75 | 75 | ], |
| 76 | 76 | $collection |
| 77 | 77 | ) |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $data = []; |
| 101 | 101 | foreach ($command->attributes as $attribute) { |
| 102 | - $filter[] = ['doc.' . $attribute, '!=', 'null', 'OR']; |
|
| 102 | + $filter[] = ['doc.'.$attribute, '!=', 'null', 'OR']; |
|
| 103 | 103 | $data[$attribute] = 'null'; |
| 104 | 104 | } |
| 105 | - $aqb = AQB::for('doc', $collection) |
|
| 105 | + $aqb = AQB::for ('doc', $collection) |
|
| 106 | 106 | ->filter($filter) |
| 107 | 107 | ->update('doc', $data, $collection) |
| 108 | 108 | ->options(['keepNull' => false]) |
@@ -35,11 +35,12 @@ discard block |
||
| 35 | 35 | $filter[] = ['doc.' . $attribute, '!=', 'null']; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $aqb = AQB::for('doc', $collection) |
|
| 39 | - ->filter($filter) |
|
| 38 | + $aqb = AQB::for('doc', $collection) { |
|
| 39 | + ->filter($filter) |
|
| 40 | 40 | ->limit(1) |
| 41 | 41 | ->return('true') |
| 42 | 42 | ->get(); |
| 43 | + } |
|
| 43 | 44 | |
| 44 | 45 | $command->aqb = $aqb; |
| 45 | 46 | |
@@ -65,8 +66,8 @@ discard block |
||
| 65 | 66 | ['doc.' . $command->to], |
| 66 | 67 | ]; |
| 67 | 68 | |
| 68 | - $aqb = AQB::for('doc', $collection) |
|
| 69 | - ->filter($filter) |
|
| 69 | + $aqb = AQB::for('doc', $collection) { |
|
| 70 | + ->filter($filter) |
|
| 70 | 71 | ->update( |
| 71 | 72 | 'doc', |
| 72 | 73 | [ |
@@ -77,6 +78,7 @@ discard block |
||
| 77 | 78 | ) |
| 78 | 79 | ->options(['keepNull' => true]) |
| 79 | 80 | ->get(); |
| 81 | + } |
|
| 80 | 82 | |
| 81 | 83 | $command->aqb = $aqb; |
| 82 | 84 | |
@@ -102,11 +104,12 @@ discard block |
||
| 102 | 104 | $filter[] = ['doc.' . $attribute, '!=', 'null', 'OR']; |
| 103 | 105 | $data[$attribute] = 'null'; |
| 104 | 106 | } |
| 105 | - $aqb = AQB::for('doc', $collection) |
|
| 106 | - ->filter($filter) |
|
| 107 | + $aqb = AQB::for('doc', $collection) { |
|
| 108 | + ->filter($filter) |
|
| 107 | 109 | ->update('doc', $data, $collection) |
| 108 | 110 | ->options(['keepNull' => false]) |
| 109 | 111 | ->get(); |
| 112 | + } |
|
| 110 | 113 | |
| 111 | 114 | $command->aqb = $aqb; |
| 112 | 115 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | $this->prefix = $prefix; |
| 110 | 110 | |
| 111 | - if (! is_null($callback)) { |
|
| 111 | + if (!is_null($callback)) { |
|
| 112 | 112 | $callback($this); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | $this->connection = $connection; |
| 126 | 126 | |
| 127 | - if (! isset($grammar)) { |
|
| 127 | + if (!isset($grammar)) { |
|
| 128 | 128 | $this->grammar = $connection->getSchemaGrammar(); |
| 129 | 129 | } |
| 130 | 130 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function compileAqlCommand($command) |
| 147 | 147 | { |
| 148 | - $compileMethod = 'compile' . ucfirst($command->name); |
|
| 148 | + $compileMethod = 'compile'.ucfirst($command->name); |
|
| 149 | 149 | if (method_exists($this->grammar, $compileMethod)) { |
| 150 | 150 | return $this->grammar->$compileMethod($this->table, $command); |
| 151 | 151 | } |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function executeCommand($command) |
| 160 | 160 | { |
| 161 | - $executeNamedMethod = 'execute' . ucfirst($command->name) . 'Command'; |
|
| 162 | - $executeHandlerMethod = 'execute' . ucfirst($command->handler) . 'Command'; |
|
| 161 | + $executeNamedMethod = 'execute'.ucfirst($command->name).'Command'; |
|
| 162 | + $executeHandlerMethod = 'execute'.ucfirst($command->handler).'Command'; |
|
| 163 | 163 | if (method_exists($this, $executeNamedMethod)) { |
| 164 | 164 | $this->$executeNamedMethod($command); |
| 165 | 165 | } elseif (method_exists($this, $executeHandlerMethod)) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | public function executeCollectionCommand($command) |
| 181 | 181 | { |
| 182 | 182 | if ($this->connection->pretending()) { |
| 183 | - $this->connection->logQuery('/* ' . $command->explanation . " */\n", []); |
|
| 183 | + $this->connection->logQuery('/* '.$command->explanation." */\n", []); |
|
| 184 | 184 | |
| 185 | 185 | return; |
| 186 | 186 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | public function executeIgnoreCommand($command) |
| 200 | 200 | { |
| 201 | 201 | if ($this->connection->pretending()) { |
| 202 | - $this->connection->logQuery('/* ' . $command->explanation . " */\n", []); |
|
| 202 | + $this->connection->logQuery('/* '.$command->explanation." */\n", []); |
|
| 203 | 203 | |
| 204 | 204 | return; |
| 205 | 205 | } |
@@ -24,9 +24,9 @@ |
||
| 24 | 24 | protected function getStub() |
| 25 | 25 | { |
| 26 | 26 | if ($this->option('pivot')) { |
| 27 | - return __DIR__ . '/stubs/pivot.model.stub'; |
|
| 27 | + return __DIR__.'/stubs/pivot.model.stub'; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - return __DIR__ . '/stubs/model.stub'; |
|
| 30 | + return __DIR__.'/stubs/model.stub'; |
|
| 31 | 31 | } |
| 32 | 32 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->connection = $connection; |
| 58 | 58 | $this->grammar = $grammar ?: $connection->getQueryGrammar(); |
| 59 | 59 | $this->processor = $processor ?: $connection->getPostProcessor(); |
| 60 | - if (! $aqb instanceof QueryBuilder) { |
|
| 60 | + if (!$aqb instanceof QueryBuilder) { |
|
| 61 | 61 | $aqb = new QueryBuilder(); |
| 62 | 62 | } |
| 63 | 63 | $this->aqb = $aqb; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function get($columns = ['*']) |
| 170 | 170 | { |
| 171 | - $results = collect($this->onceWithColumns(Arr::wrap($columns), function () { |
|
| 171 | + $results = collect($this->onceWithColumns(Arr::wrap($columns), function() { |
|
| 172 | 172 | return $this->runSelect(); |
| 173 | 173 | })); |
| 174 | 174 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function registerAlias(string $table, string $alias): void |
| 211 | 211 | { |
| 212 | - if (! isset($this->aliasRegistry[$table])) { |
|
| 212 | + if (!isset($this->aliasRegistry[$table])) { |
|
| 213 | 213 | $this->aliasRegistry[$table] = $alias; |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $this->aqb = new QueryBuilder(); |
| 243 | 243 | |
| 244 | - if (! $results->isEmpty()) { |
|
| 244 | + if (!$results->isEmpty()) { |
|
| 245 | 245 | return array_change_key_case((array) $results[0])['aggregate']; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | 'boolean' |
| 323 | 323 | ); |
| 324 | 324 | |
| 325 | - if (! $value instanceof Expression) { |
|
| 325 | + if (!$value instanceof Expression) { |
|
| 326 | 326 | $this->addBinding($value, 'where'); |
| 327 | 327 | } |
| 328 | 328 | |
@@ -358,8 +358,8 @@ discard block |
||
| 358 | 358 | */ |
| 359 | 359 | protected function invalidOperator($operator) |
| 360 | 360 | { |
| 361 | - return ! in_array(strtolower($operator), $this->operators, true) && |
|
| 362 | - ! isset($this->grammar->getOperators()[strtoupper($operator)]); |
|
| 361 | + return !in_array(strtolower($operator), $this->operators, true) && |
|
| 362 | + !isset($this->grammar->getOperators()[strtoupper($operator)]); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | if ($this->isQueryable($column)) { |
| 390 | 390 | [$query, $bindings] = $this->createSub($column); |
| 391 | 391 | |
| 392 | - $column = new Expression('(' . $query . ')'); |
|
| 392 | + $column = new Expression('('.$query.')'); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [ |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $this->beginTransaction(); |
| 31 | 31 | |
| 32 | - return tap($callback($this), function () use ($options, $attempts) { |
|
| 32 | + return tap($callback($this), function() use ($options, $attempts) { |
|
| 33 | 33 | $this->commit($options, $attempts); |
| 34 | 34 | }); |
| 35 | 35 | } |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // $query = addslashes($query); |
| 82 | - $jsCommand = 'db._query(aql`' . $query . '`'; |
|
| 83 | - if (! empty($bindings)) { |
|
| 82 | + $jsCommand = 'db._query(aql`'.$query.'`'; |
|
| 83 | + if (!empty($bindings)) { |
|
| 84 | 84 | $bindings = json_encode($bindings); |
| 85 | - $jsCommand .= ', ' . $bindings; |
|
| 85 | + $jsCommand .= ', '.$bindings; |
|
| 86 | 86 | } |
| 87 | 87 | $jsCommand .= ');'; |
| 88 | 88 | $command = new IlluminateFluent([ |
@@ -209,10 +209,10 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function commit($options = [], $attempts = 1) |
| 211 | 211 | { |
| 212 | - if (! $this->transactions > 0) { |
|
| 212 | + if (!$this->transactions > 0) { |
|
| 213 | 213 | throw new \Exception('Transaction committed before starting one.'); |
| 214 | 214 | } |
| 215 | - if (! isset($this->transactionCommands[$this->transactions]) || empty($this->transactionCommands[$this->transactions])) { |
|
| 215 | + if (!isset($this->transactionCommands[$this->transactions]) || empty($this->transactionCommands[$this->transactions])) { |
|
| 216 | 216 | throw new \Exception('Cannot commit an empty transaction.'); |
| 217 | 217 | } |
| 218 | 218 | |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | // Add database driver. |
| 40 | 40 | $this->app->resolving( |
| 41 | 41 | 'db', |
| 42 | - function ($db) { |
|
| 42 | + function($db) { |
|
| 43 | 43 | $db->extend( |
| 44 | 44 | 'arangodb', |
| 45 | - function ($config, $name) { |
|
| 45 | + function($config, $name) { |
|
| 46 | 46 | $config['name'] = $name; |
| 47 | 47 | $connection = new Connection($config); |
| 48 | 48 | $connection->setSchemaGrammar(new SchemaGrammar()); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | 56 | $this->app->resolving( |
| 57 | - function ($app) { |
|
| 57 | + function($app) { |
|
| 58 | 58 | if (class_exists('Illuminate\Foundation\AliasLoader')) { |
| 59 | 59 | $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
| 60 | 60 | $loader->alias('Eloquent', 'LaravelFreelancerNL\Aranguent\Eloquent\Model'); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | protected function updateTimestamps(array $values) |
| 64 | 64 | { |
| 65 | - if (! $this->model->usesTimestamps() || |
|
| 65 | + if (!$this->model->usesTimestamps() || |
|
| 66 | 66 | is_null($this->model->getUpdatedAtColumn()) || |
| 67 | 67 | is_null($this->model->getCreatedAtColumn())) { |
| 68 | 68 | return $values; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $timestamps[$updatedAtColumn] = $timestamp; |
| 73 | 73 | |
| 74 | 74 | $createdAtColumn = $this->model->getCreatedAtColumn(); |
| 75 | - if (! isset($values[$createdAtColumn]) && ! isset($this->model->$createdAtColumn)) { |
|
| 75 | + if (!isset($values[$createdAtColumn]) && !isset($this->model->$createdAtColumn)) { |
|
| 76 | 76 | $timestamps[$createdAtColumn] = $timestamp; |
| 77 | 77 | } |
| 78 | 78 | |