Skip to content

Commit bdb4e99

Browse files
authored
Update HasParser.php
1 parent fd1c9ba commit bdb4e99

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Http/Api/Contracts/HasParser.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ protected function filterByParent(): array
5656
$param = reset($parent);
5757
}else{
5858
$key = strtolower(class_basename($parent));
59+
$param = $key;
5960
}
6061

61-
$routeRelation = $this->request->route()->parameter($key);
62+
$routeRelation = $this->request->route()->parameter($param);
6263

6364
$child = resolve($this->model());
6465

6566
if(!$routeRelation instanceof Model){
66-
$bindingField = $this->request->route()->bindingFieldFor($key) ?? $child->{$key}()->getRelated()->getKeyName();
67+
$bindingField = $this->request->route()->bindingFieldFor($param) ?? $child->{$key}()->getRelated()->getKeyName();
6768
$routeRelation = $child->{$key}()->getRelated()->where($bindingField, $routeRelation)->firstOrFail();
6869
}
6970

0 commit comments

Comments
 (0)