Skip to content

Commit b129178

Browse files
author
Marcel Gwerder
committed
Get pk from the model if possible
1 parent 08d31f4 commit b129178

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Parser.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,18 @@ public function parse($options, $multiple = false)
203203
} else {
204204
$identification = $options;
205205

206-
if (is_numeric($identification)) {
207-
$this->query->where('id', $identification);
208-
} else if (is_array($identification)) {
206+
if (is_array($identification)) {
209207
foreach ($identification as $column => $value) {
210208
$this->query->where($column, $value);
211209
}
210+
} else {
211+
if($this->isEloquentBuilder) {
212+
$primaryKey = $this->builder->getModel()->getQualifiedKeyName();
213+
} else {
214+
$primaryKey = $this->getQualifiedColumnName('id');
215+
}
216+
217+
$this->query->where($primaryKey, $identification);
212218
}
213219
}
214220

0 commit comments

Comments
 (0)