@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | public function saveData($table, $item) |
9 | 9 | { |
10 | 10 | // If have primary id |
11 | - if(isset($item['id'])) |
|
11 | + if (isset($item['id'])) |
|
12 | 12 | { |
13 | - if(\DB::table($table)->where('id', $item['id'])->count() > 0) |
|
13 | + if (\DB::table($table)->where('id', $item['id'])->count() > 0) |
|
14 | 14 | { |
15 | 15 | \DB::table($table)->where('id', $item['id'])->update($item); |
16 | 16 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | })->keys()->values(); |
27 | 27 | |
28 | 28 | // If there isnt any column with _id, so check that every column matches |
29 | - if($ids->count() <= 0) { |
|
29 | + if ($ids->count() <= 0) { |
|
30 | 30 | $ids = collect($item)->keys()->values(); |
31 | 31 | } |
32 | 32 | $object = \DB::table($table); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | // save or update |
38 | - if($object->count() > 0) |
|
38 | + if ($object->count() > 0) |
|
39 | 39 | { |
40 | 40 | $object->update($item); |
41 | 41 | } |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | // Get tables to ignore |
86 | 86 | $config = config('db-exporter.seeds'); |
87 | 87 | $ignore_tables = collect([]); |
88 | - if(!is_null($config) && !is_null($config['ignore_tables'])) { |
|
88 | + if (!is_null($config) && !is_null($config['ignore_tables'])) { |
|
89 | 89 | $ignore_tables = collect($config['ignore_tables']); |
90 | 90 | } |
91 | 91 | |
92 | 92 | // Loop over the tables |
93 | 93 | foreach ($tables as $key => $value) |
94 | 94 | { |
95 | - if($ignore_tables->contains($value['table_name'])) { |
|
95 | + if ($ignore_tables->contains($value['table_name'])) { |
|
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | ];"; |
126 | 126 | |
127 | 127 | if ($this->hasTableData($tableData)) { |
128 | - $stub = $insertStub.' |
|
128 | + $stub = $insertStub . ' |
|
129 | 129 | |
130 | 130 | foreach($data as $item) |
131 | 131 | { |
132 | - $this->saveData("'.$tableName.'", $item); |
|
132 | + $this->saveData("'.$tableName . '", $item); |
|
133 | 133 | }'; |
134 | 134 | } |
135 | 135 | |
@@ -164,13 +164,13 @@ discard block |
||
164 | 164 | |
165 | 165 | private function insertPropertyAndValue($prop, $value) |
166 | 166 | { |
167 | - if(strlen($prop) > 0) { |
|
167 | + if (strlen($prop) > 0) { |
|
168 | 168 | $prop = "'{$prop}'"; |
169 | 169 | } else { |
170 | 170 | $prop = 'null'; |
171 | 171 | } |
172 | 172 | |
173 | - if(strlen($value) > 0) { |
|
173 | + if (strlen($value) > 0) { |
|
174 | 174 | $value = str_replace("'", "\'", $value); |
175 | 175 | $value = "'{$value}'"; |
176 | 176 | } else { |