@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $referencePrimaryKey = null |
86 | 86 | ) { |
87 | 87 | // Map Relation Model |
88 | - $this->relationModel =& $relationModel; |
|
88 | + $this->relationModel = & $relationModel; |
|
89 | 89 | |
90 | 90 | // Map Relation Table |
91 | 91 | $this->relationTable = $relationModel->table; |
@@ -139,6 +139,6 @@ discard block |
||
139 | 139 | 'tb_', |
140 | 140 | ]; |
141 | 141 | |
142 | - return $this->referencePrimaryKey . '_' . str_replace($tablePrefixes, '', $this->referenceTable); |
|
142 | + return $this->referencePrimaryKey.'_'.str_replace($tablePrefixes, '', $this->referenceTable); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | \ No newline at end of file |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $referencePrimaryKey = null |
86 | 86 | ) { |
87 | 87 | // Map Reference Model |
88 | - $this->referenceModel =& $referenceModel; |
|
88 | + $this->referenceModel = & $referenceModel; |
|
89 | 89 | |
90 | 90 | // Map Reference Table |
91 | 91 | $this->referenceTable = $referenceModel->table; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->mapRelationModel($relationModel); |
98 | 98 | |
99 | 99 | // Map Relation Foreign Key |
100 | - $this->relationForeignKey = $this->relationTable . '.' . (isset($relationForeignKey) ? $relationForeignKey |
|
100 | + $this->relationForeignKey = $this->relationTable.'.'.(isset($relationForeignKey) ? $relationForeignKey |
|
101 | 101 | : $this->mapRelationForeignKey()); |
102 | 102 | } |
103 | 103 | |
@@ -139,6 +139,6 @@ discard block |
||
139 | 139 | 'tb_', |
140 | 140 | ]; |
141 | 141 | |
142 | - return $this->referencePrimaryKey . '_' . str_replace($tablePrefixes, '', $this->referenceTable); |
|
142 | + return $this->referencePrimaryKey.'_'.str_replace($tablePrefixes, '', $this->referenceTable); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | \ No newline at end of file |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | $this->mapReferenceModel($referenceModel); |
107 | 107 | |
108 | 108 | // Map Intermediate Table |
109 | - $this->pivotTable = $this->relationTable . '_' . $this->referenceTable; |
|
109 | + $this->pivotTable = $this->relationTable.'_'.$this->referenceTable; |
|
110 | 110 | |
111 | 111 | if (isset($pivotTable)) { |
112 | 112 | $this->pivotTable = $pivotTable; |
113 | 113 | } |
114 | 114 | |
115 | - $this->pivotRelationKey = $this->pivotTable . '.' . $this->pivotRelationKey; |
|
116 | - $this->pivotReferenceKey = $this->pivotTable . '.' . $this->pivotReferenceKey; |
|
115 | + $this->pivotRelationKey = $this->pivotTable.'.'.$this->pivotRelationKey; |
|
116 | + $this->pivotReferenceKey = $this->pivotTable.'.'.$this->pivotReferenceKey; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // ------------------------------------------------------------------------ |
@@ -131,16 +131,16 @@ discard block |
||
131 | 131 | $this->relationModel = $relationModel; |
132 | 132 | $this->relationTable = $this->relationModel->table; |
133 | 133 | $this->relationPrimaryKey = $this->relationModel->primaryKey; |
134 | - $this->pivotRelationKey = $this->relationModel->primaryKey . '_' . $this->relationModel->table; |
|
134 | + $this->pivotRelationKey = $this->relationModel->primaryKey.'_'.$this->relationModel->table; |
|
135 | 135 | } elseif (class_exists($relationModel)) { |
136 | 136 | $this->relationModel = new $relationModel(); |
137 | 137 | $this->relationTable = $this->relationModel->table; |
138 | - $this->relationPrimaryKey = $this->relationModel->table . '.' . $this->relationModel->primaryKey; |
|
139 | - $this->pivotRelationKey = $this->relationModel->primaryKey . '_' . $this->relationModel->table; |
|
138 | + $this->relationPrimaryKey = $this->relationModel->table.'.'.$this->relationModel->primaryKey; |
|
139 | + $this->pivotRelationKey = $this->relationModel->primaryKey.'_'.$this->relationModel->table; |
|
140 | 140 | } else { |
141 | 141 | $this->relationTable = $relationModel; |
142 | - $this->relationPrimaryKey = $this->relationTable . '.id'; |
|
143 | - $this->pivotRelationKey = $this->relationTable . '.id_' . $this->relationTable; |
|
142 | + $this->relationPrimaryKey = $this->relationTable.'.id'; |
|
143 | + $this->pivotRelationKey = $this->relationTable.'.id_'.$this->relationTable; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | if ($referenceModel instanceof Model) { |
159 | 159 | $this->referenceTable = $referenceModel->table; |
160 | 160 | $this->referencePrimaryKey = $referenceModel->primaryKey; |
161 | - $this->pivotReferenceKey = $referenceModel->primaryKey . '_' . $this->referenceTable; |
|
161 | + $this->pivotReferenceKey = $referenceModel->primaryKey.'_'.$this->referenceTable; |
|
162 | 162 | } elseif (class_exists($referenceModel)) { |
163 | 163 | $referenceModel = new $referenceModel(); |
164 | 164 | $this->referenceTable = $referenceModel->table; |
165 | - $this->referencePrimaryKey = $this->referenceTable . '.' . $referenceModel->primaryKey; |
|
166 | - $this->pivotReferenceKey = $referenceModel->primaryKey . '_' . $this->referenceTable; |
|
165 | + $this->referencePrimaryKey = $this->referenceTable.'.'.$referenceModel->primaryKey; |
|
166 | + $this->pivotReferenceKey = $referenceModel->primaryKey.'_'.$this->referenceTable; |
|
167 | 167 | } else { |
168 | 168 | $this->referenceTable = $referenceModel; |
169 | - $this->referencePrimaryKey = $this->referenceTable . '.id'; |
|
170 | - $this->pivotReferenceKey = 'id_' . $this->referenceTable; |
|
169 | + $this->referencePrimaryKey = $this->referenceTable.'.id'; |
|
170 | + $this->pivotReferenceKey = 'id_'.$this->referenceTable; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
174 | 174 | \ No newline at end of file |
@@ -48,7 +48,7 @@ |
||
48 | 48 | $this->map->relationModel); |
49 | 49 | } |
50 | 50 | } |
51 | - } elseif ( ! empty($this->map->relationTable)) { |
|
51 | + } elseif (!empty($this->map->relationTable)) { |
|
52 | 52 | $result = $this->map->referenceModel->qb |
53 | 53 | ->from($this->map->relationTable) |
54 | 54 | ->getWhere($conditions); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | return $this->map->relationModel->row = $this->map->relationModel->result->first(); |
51 | 51 | } |
52 | 52 | } |
53 | - } elseif ( ! empty($this->map->relationTable)) { |
|
53 | + } elseif (!empty($this->map->relationTable)) { |
|
54 | 54 | $result = $this->map->referenceModel->qb |
55 | 55 | ->from($this->map->relationTable) |
56 | 56 | ->getWhere($conditions, 1); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | return $this->map->referenceModel->row = $this->map->referenceModel->result->first(); |
51 | 51 | } |
52 | 52 | } |
53 | - } elseif ( ! empty($this->map->referenceTable)) { |
|
53 | + } elseif (!empty($this->map->referenceTable)) { |
|
54 | 54 | $result = $this->map->relationModel->qb |
55 | 55 | ->from($this->map->referenceTable) |
56 | 56 | ->getWhere($conditions, 1); |
@@ -85,57 +85,57 @@ |
||
85 | 85 | |
86 | 86 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
87 | 87 | |
88 | - if ( ! isset($sets[ 'record_status' ])) { |
|
89 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
88 | + if (!isset($sets['record_status'])) { |
|
89 | + $sets['record_status'] = $this->recordStatus; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | if (empty($this->primary_keys)) { |
93 | 93 | $primary_key = isset($this->primary_key) ? $this->primary_key : 'id'; |
94 | 94 | |
95 | - if (empty($sets[ $primary_key ])) { |
|
96 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
97 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
95 | + if (empty($sets[$primary_key])) { |
|
96 | + if (!isset($sets['record_create_user'])) { |
|
97 | + $sets['record_create_user'] = $this->recordUser; |
|
98 | 98 | } |
99 | 99 | |
100 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
101 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
100 | + if (!isset($sets['record_create_timestamp'])) { |
|
101 | + $sets['record_create_timestamp'] = $timestamp; |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | } else { |
105 | 105 | foreach ($this->primary_keys as $primary_key) { |
106 | - if (empty($sets[ $primary_key ])) { |
|
107 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
108 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
106 | + if (empty($sets[$primary_key])) { |
|
107 | + if (!isset($sets['record_create_user'])) { |
|
108 | + $sets['record_create_user'] = $this->recordUser; |
|
109 | 109 | } |
110 | 110 | |
111 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
112 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
111 | + if (!isset($sets['record_create_timestamp'])) { |
|
112 | + $sets['record_create_timestamp'] = $timestamp; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
118 | + $sets['record_update_user'] = $this->recordUser; |
|
119 | 119 | |
120 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
121 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
120 | + if (!isset($sets['record_update_timestamp'])) { |
|
121 | + $sets['record_update_timestamp'] = $timestamp; |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | 125 | protected function updateRecordSets(array &$sets) |
126 | 126 | { |
127 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
128 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
127 | + $sets['record_status'] = $this->recordStatus; |
|
128 | + $sets['record_update_user'] = $this->recordUser; |
|
129 | 129 | |
130 | 130 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
131 | 131 | |
132 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
133 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
132 | + if (!isset($sets['record_update_timestamp'])) { |
|
133 | + $sets['record_update_timestamp'] = $timestamp; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | if ($this->recordStatus === 'PUBLISH') { |
137 | - $sets[ 'record_delete_timestamp' ] = null; |
|
138 | - $sets[ 'record_delete_user' ] = null; |
|
137 | + $sets['record_delete_timestamp'] = null; |
|
138 | + $sets['record_delete_user'] = null; |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | if (method_exists($this, 'getRecordOrdering')) { |
52 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
53 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($table); |
|
52 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
53 | + $sets['record_ordering'] = $this->getRecordOrdering($table); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | |
88 | 88 | if (empty($where)) { |
89 | 89 | if (empty($this->primaryKeys)) { |
90 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
90 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
91 | 91 | } else { |
92 | 92 | foreach ($this->primaryKeys as $primaryKey) { |
93 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
93 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | if (method_exists($this, 'getRecordOrdering')) { |
111 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
112 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($table); |
|
111 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
112 | + $sets['record_ordering'] = $this->getRecordOrdering($table); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | foreach ($sets as $set) { |
134 | 134 | $this->insertRecordSets($set); |
135 | 135 | |
136 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
137 | - $set[ 'record_ordering' ] = $this->getRecordOrdering($table); |
|
136 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
137 | + $set['record_ordering'] = $this->getRecordOrdering($table); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | } |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | |
164 | 164 | $where = []; |
165 | 165 | if (empty($this->primaryKeys)) { |
166 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
167 | - $this->qb->where($primaryKey, $sets[ $primaryKey ]); |
|
166 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
167 | + $this->qb->where($primaryKey, $sets[$primaryKey]); |
|
168 | 168 | } else { |
169 | 169 | foreach ($this->primaryKeys as $primaryKey) { |
170 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
170 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | foreach ($sets as $set) { |
180 | 180 | $this->updateRecordSets($set); |
181 | 181 | |
182 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
183 | - $set[ 'record_ordering' ] = $this->getRecordOrdering($table); |
|
182 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
183 | + $set['record_ordering'] = $this->getRecordOrdering($table); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
@@ -219,19 +219,19 @@ discard block |
||
219 | 219 | $where = []; |
220 | 220 | |
221 | 221 | if (empty($this->primaryKeys)) { |
222 | - $where[ $primaryKey ] = $id; |
|
223 | - $sets[ $primaryKey ] = $id; |
|
222 | + $where[$primaryKey] = $id; |
|
223 | + $sets[$primaryKey] = $id; |
|
224 | 224 | } elseif (is_array($id)) { |
225 | 225 | foreach ($this->primaryKeys as $primaryKey) { |
226 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
227 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
226 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
227 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
228 | 228 | } |
229 | 229 | } else { |
230 | 230 | foreach ($this->primaryKeys as $primaryKey) { |
231 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
231 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
232 | 232 | } |
233 | 233 | |
234 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
234 | + $sets[reset($this->primaryKeys)] = $id; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // Reset Primary Keys |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $affectedRows = []; |
282 | 282 | |
283 | 283 | foreach ($ids as $id) { |
284 | - $affectedRows[ $id ] = $this->trash($id); |
|
284 | + $affectedRows[$id] = $this->trash($id); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | return $affectedRows; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | $affectedRows = []; |
295 | 295 | |
296 | 296 | foreach ($ids as $id) { |
297 | - $affectedRows[ $id ] = $this->trashBy($id, $where, $table); |
|
297 | + $affectedRows[$id] = $this->trashBy($id, $where, $table); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | return $affectedRows; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | public function delete($id, $force = false, $table = null) |
306 | 306 | { |
307 | - if ((isset($table) AND is_bool($table)) OR ! isset($table)) { |
|
307 | + if ((isset($table) AND is_bool($table)) OR !isset($table)) { |
|
308 | 308 | $table = $this->table; |
309 | 309 | } |
310 | 310 | |
@@ -312,13 +312,13 @@ discard block |
||
312 | 312 | |
313 | 313 | $where = []; |
314 | 314 | if (empty($this->primaryKeys)) { |
315 | - $where[ $primaryKey ] = $id; |
|
315 | + $where[$primaryKey] = $id; |
|
316 | 316 | } elseif (is_array($id)) { |
317 | 317 | foreach ($this->primaryKeys as $primaryKey) { |
318 | - $where[ $primaryKey ] = $id[ $primaryKey ]; |
|
318 | + $where[$primaryKey] = $id[$primaryKey]; |
|
319 | 319 | } |
320 | 320 | } else { |
321 | - $where[ reset($this->primaryKeys) ] = $id; |
|
321 | + $where[reset($this->primaryKeys)] = $id; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | // Reset Primary Keys |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $affectedRows = []; |
357 | 357 | |
358 | 358 | foreach ($ids as $id) { |
359 | - $affectedRows[ $id ] = $this->delete($id, $force, $table); |
|
359 | + $affectedRows[$id] = $this->delete($id, $force, $table); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | return $affectedRows; |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $affectedRows = []; |
368 | 368 | |
369 | 369 | foreach ($ids as $id) { |
370 | - $affectedRows[ $id ] = $this->deleteBy($id, $where, $force, $table); |
|
370 | + $affectedRows[$id] = $this->deleteBy($id, $where, $force, $table); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | return $affectedRows; |
@@ -384,19 +384,19 @@ discard block |
||
384 | 384 | $where = []; |
385 | 385 | |
386 | 386 | if (empty($this->primaryKeys)) { |
387 | - $where[ $primaryKey ] = $id; |
|
388 | - $sets[ $primaryKey ] = $id; |
|
387 | + $where[$primaryKey] = $id; |
|
388 | + $sets[$primaryKey] = $id; |
|
389 | 389 | } elseif (is_array($id)) { |
390 | 390 | foreach ($this->primaryKeys as $primaryKey) { |
391 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
392 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
391 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
392 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
393 | 393 | } |
394 | 394 | } else { |
395 | 395 | foreach ($this->primaryKeys as $primaryKey) { |
396 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
396 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
397 | 397 | } |
398 | 398 | |
399 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
399 | + $sets[reset($this->primaryKeys)] = $id; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | // Reset Primary Keys |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $affectedRows = []; |
440 | 440 | |
441 | 441 | foreach ($ids as $id) { |
442 | - $affectedRows[ $id ] = $this->publish($id, $table); |
|
442 | + $affectedRows[$id] = $this->publish($id, $table); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | return $affectedRows; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $affectedRows = []; |
453 | 453 | |
454 | 454 | foreach ($ids as $id) { |
455 | - $affectedRows[ $id ] = $this->publishBy($id, $where, $table); |
|
455 | + $affectedRows[$id] = $this->publishBy($id, $where, $table); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | return $affectedRows; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ]); |
71 | 71 | } |
72 | 72 | |
73 | - $update[ 'id' ] = $row->id; |
|
73 | + $update['id'] = $row->id; |
|
74 | 74 | |
75 | 75 | if ($this->hasChild($row->id)) { |
76 | 76 | $right = $this->rebuild($row->id, $right, $depth + 1); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | ->update($update = [ |
81 | 81 | 'record_right' => $right, |
82 | 82 | ]); |
83 | - $update[ 'id' ] = $row->id; |
|
83 | + $update['id'] = $row->id; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $i++; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | ->get(); |
110 | 110 | |
111 | 111 | if ($result) { |
112 | - return (bool)($result->count() == 0 ? false : true); |
|
112 | + return (bool) ($result->count() == 0 ? false : true); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return false; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | ->get(); |
162 | 162 | |
163 | 163 | if ($result) { |
164 | - return (bool)($result->count() == 0 ? false : true); |
|
164 | + return (bool) ($result->count() == 0 ? false : true); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | return false; |