@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | 'token' => env('AWS_SESSION_TOKEN'), |
34 | 34 | ], |
35 | 35 | 'region' => env('DYNAMODB_REGION'), |
36 | - // if true, it will use Laravel Log. |
|
37 | - // For advanced options, see http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/configuration.html |
|
36 | + // if true, it will use Laravel Log. |
|
37 | + // For advanced options, see http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/configuration.html |
|
38 | 38 | 'debug' => env('DYNAMODB_DEBUG'), |
39 | 39 | ], |
40 | 40 | 'aws_iam_role' => [ |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | 'secret' => 'secret', |
48 | 48 | ], |
49 | 49 | 'region' => 'stub', |
50 | - // see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html |
|
50 | + // see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html |
|
51 | 51 | 'endpoint' => env('DYNAMODB_LOCAL_ENDPOINT'), |
52 | 52 | 'debug' => true, |
53 | 53 | ], |
@@ -71,7 +71,7 @@ |
||
71 | 71 | protected function getDebugOptions($debug = false) |
72 | 72 | { |
73 | 73 | if ($debug === true) { |
74 | - $logfn = function ($msg) { |
|
74 | + $logfn = function($msg) { |
|
75 | 75 | Log::info($msg); |
76 | 76 | }; |
77 | 77 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | */ |
38 | 38 | public function finalize() |
39 | 39 | { |
40 | - $this->query = array_filter($this->query, function ($value) { |
|
40 | + $this->query = array_filter($this->query, function($value) { |
|
41 | 41 | return !empty($value) || is_bool($value) || is_numeric($value); |
42 | 42 | }); |
43 | 43 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | DynamoDbModel::setDynamoDbClientService($this->app->make(DynamoDbClientInterface::class)); |
19 | 19 | |
20 | 20 | $this->publishes([ |
21 | - __DIR__.'/../config/dynamodb.php' => app()->basePath('config/dynamodb.php'), |
|
21 | + __DIR__ . '/../config/dynamodb.php' => app()->basePath('config/dynamodb.php'), |
|
22 | 22 | ]); |
23 | 23 | } |
24 | 24 | |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | 'nullify_invalid' => true, |
32 | 32 | ]; |
33 | 33 | |
34 | - $this->app->singleton(DynamoDbClientInterface::class, function () use ($marshalerOptions) { |
|
34 | + $this->app->singleton(DynamoDbClientInterface::class, function() use ($marshalerOptions) { |
|
35 | 35 | $client = new DynamoDbClientService(new Marshaler($marshalerOptions), new EmptyAttributeFilter()); |
36 | 36 | |
37 | 37 | return $client; |
38 | 38 | }); |
39 | 39 | |
40 | - $this->app->singleton('dynamodb', function () { |
|
40 | + $this->app->singleton('dynamodb', function() { |
|
41 | 41 | return new DynamoDbManager(app(DynamoDbClientInterface::class)); |
42 | 42 | }); |
43 | 43 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | { |
103 | 103 | $keyConditions = $this->keyConditions() ?: []; |
104 | 104 | |
105 | - return array_filter($this->conditions, function ($condition) use ($keyConditions) { |
|
105 | + return array_filter($this->conditions, function($condition) use ($keyConditions) { |
|
106 | 106 | return array_search($condition, $keyConditions) === false; |
107 | 107 | }); |
108 | 108 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private function getCondition($column) |
146 | 146 | { |
147 | - return H::array_first($this->conditions, function ($condition) use ($column) { |
|
147 | + return H::array_first($this->conditions, function($condition) use ($column) { |
|
148 | 148 | return $condition['column'] === $column; |
149 | 149 | }); |
150 | 150 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | private function getConditions($columns) |
158 | 158 | { |
159 | - return array_filter($this->conditions, function ($condition) use ($columns) { |
|
159 | + return array_filter($this->conditions, function($condition) use ($columns) { |
|
160 | 160 | return in_array($condition['column'], $columns); |
161 | 161 | }); |
162 | 162 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | |
131 | - if ($create && $this->fireModelEvent('creating') === false) { |
|
131 | + if ($create && $this->fireModelEvent('creating') === false) { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | return false; |
170 | 170 | } |
171 | 171 | |
172 | - if ($create && $this->fireModelEvent('creating') === false) { |
|
172 | + if ($create && $this->fireModelEvent('creating') === false) { |
|
173 | 173 | return false; |
174 | 174 | } |
175 | 175 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $savePromise = $this->newQuery()->saveAsync(); |
185 | 185 | |
186 | - $savePromise->then(function ($result) use ($create, $options) { |
|
186 | + $savePromise->then(function($result) use ($create, $options) { |
|
187 | 187 | if (array_get($result, '@metadata.statusCode') === 200) { |
188 | 188 | $this->exists = true; |
189 | 189 | $this->wasRecentlyCreated = $create; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | |
254 | 254 | $deletePromise = $this->newQuery()->deleteAsync(); |
255 | 255 | |
256 | - $deletePromise->then(function () { |
|
256 | + $deletePromise->then(function() { |
|
257 | 257 | $this->fireModelEvent('deleted', false); |
258 | 258 | }); |
259 | 259 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | public function refresh() |
272 | 272 | { |
273 | - if (! $this->exists) { |
|
273 | + if (!$this->exists) { |
|
274 | 274 | return $this; |
275 | 275 | } |
276 | 276 |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | |
503 | 503 | $table = $this->model->getTable(); |
504 | 504 | |
505 | - $keys = collect($ids)->map(function ($id) { |
|
506 | - if (! is_array($id)) { |
|
505 | + $keys = collect($ids)->map(function($id) { |
|
506 | + if (!is_array($id)) { |
|
507 | 507 | $id = [$this->model->getKeyName() => $id]; |
508 | 508 | } |
509 | 509 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | |
535 | 535 | public function firstOrNew(array $attributes, array $values = []) |
536 | 536 | { |
537 | - if (! is_null($instance = $this->where($attributes)->first())) { |
|
537 | + if (!is_null($instance = $this->where($attributes)->first())) { |
|
538 | 538 | return $instance; |
539 | 539 | } |
540 | 540 | |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | |
544 | 544 | public function firstOrCreate(array $attributes, array $values = []) |
545 | 545 | { |
546 | - if (! is_null($instance = $this->where($attributes)->first())) { |
|
546 | + if (!is_null($instance = $this->where($attributes)->first())) { |
|
547 | 547 | return $instance; |
548 | 548 | } |
549 | 549 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | if (count($result) == count(array_unique($id))) { |
568 | 568 | return $result; |
569 | 569 | } |
570 | - } elseif (! is_null($result)) { |
|
570 | + } elseif (!is_null($result)) { |
|
571 | 571 | return $result; |
572 | 572 | } |
573 | 573 | |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | |
587 | 587 | public function firstOrFail($columns = []) |
588 | 588 | { |
589 | - if (! is_null($model = $this->first($columns))) { |
|
589 | + if (!is_null($model = $this->first($columns))) { |
|
590 | 590 | return $model; |
591 | 591 | } |
592 | 592 | |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | $op = 'Scan'; |
772 | 772 | $queryBuilder = DynamoDb::table($this->model->getTable()); |
773 | 773 | |
774 | - if (! empty($this->wheres)) { |
|
774 | + if (!empty($this->wheres)) { |
|
775 | 775 | $analyzer = $this->getConditionAnalyzer(); |
776 | 776 | |
777 | 777 | if ($keyConditions = $analyzer->keyConditions()) { |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | $keys = collect($this->model->getKeyNames()); |
840 | 840 | |
841 | 841 | // could be ['id' => 'foo'], ['id1' => 'foo', 'id2' => 'bar'] |
842 | - $single = $keys->first(function ($name) use ($id) { |
|
842 | + $single = $keys->first(function($name) use ($id) { |
|
843 | 843 | return !isset($id[$name]); |
844 | 844 | }) === null; |
845 | 845 | |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | */ |
894 | 894 | public function withoutGlobalScope($scope) |
895 | 895 | { |
896 | - if (! is_string($scope)) { |
|
896 | + if (!is_string($scope)) { |
|
897 | 897 | $scope = get_class($scope); |
898 | 898 | } |
899 | 899 | |
@@ -940,18 +940,18 @@ discard block |
||
940 | 940 | */ |
941 | 941 | public function applyScopes() |
942 | 942 | { |
943 | - if (! $this->scopes) { |
|
943 | + if (!$this->scopes) { |
|
944 | 944 | return $this; |
945 | 945 | } |
946 | 946 | |
947 | 947 | $builder = $this; |
948 | 948 | |
949 | 949 | foreach ($builder->scopes as $identifier => $scope) { |
950 | - if (! isset($builder->scopes[$identifier])) { |
|
950 | + if (!isset($builder->scopes[$identifier])) { |
|
951 | 951 | continue; |
952 | 952 | } |
953 | 953 | |
954 | - $builder->callScope(function (DynamoDbQueryBuilder $builder) use ($scope) { |
|
954 | + $builder->callScope(function(DynamoDbQueryBuilder $builder) use ($scope) { |
|
955 | 955 | // If the scope is a Closure we will just go ahead and call the scope with the |
956 | 956 | // builder instance. The "callScope" method will properly group the clauses |
957 | 957 | // that are added to this query so "where" clauses maintain proper logic. |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | */ |
1011 | 1011 | public function __call($method, $parameters) |
1012 | 1012 | { |
1013 | - if (method_exists($this->model, $scope = 'scope'.ucfirst($method))) { |
|
1013 | + if (method_exists($this->model, $scope = 'scope' . ucfirst($method))) { |
|
1014 | 1014 | return $this->callScope([$this->model, $scope], $parameters); |
1015 | 1015 | } |
1016 | 1016 |