Skip to content

Commit a17683c

Browse files
committed
Allow to define relation_name and convert it to relationName
1 parent 228d334 commit a17683c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/ResourceRelations.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ final public function handle(Builder $query, Closure $next): Builder | Collectio
6565
}
6666

6767
foreach ((array) $relation_name as $relationship_name) {
68+
// convert relation_name => relationName
69+
$relationship_name = str($relationship_name)->studly()->lcfirst()->value();
6870
// check if a method with the relation name exists
6971
if (method_exists($this, $method = explode('.', $mapping, 2)[0])) {
7072
// redirect relation to the custom method implementation

0 commit comments

Comments
 (0)