Skip to content

Commit c021895

Browse files
committed
refactoring
1 parent a778fcb commit c021895

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

core/model/Model.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private function fields($dados = null)
3535
foreach ($dados as $k => $v) {
3636
$fields[] = $k;
3737
}
38-
$fields = implode(',', $fields);
38+
$fields = implode(',', $fields);
3939

4040
return $fields;
4141
}
@@ -113,12 +113,13 @@ public function save($dados)
113113

114114
if (isset($dados[$this->pk])) {
115115
$this->find([$this->pk => $dados[$this->pk]]);
116-
if ($this->count > 0) {
117-
$this->update($dados);
118-
} else {
119-
$this->create($dados);
120-
}
121116
}
117+
118+
if ($this->count > 0) {
119+
return $this->update($dados);
120+
}
121+
122+
return $this->create($dados);
122123
}
123124

124125
public function update($dados)

0 commit comments

Comments
 (0)