File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
src/Database/Eloquent/Relations Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -19,4 +19,11 @@ public function addConstraints()
1919 }
2020 }
2121
22+ protected function getKeys (array $ models , $ key = null )
23+ {
24+ return collect ($ models )->map (function ($ value ) use ($ key ) {
25+ return $ key ? $ value ->getAttribute ($ key ) : $ value ->getKey ();
26+ })->values ()->filter ()->unique (null , true )->sort ()->all ();
27+ }
28+
2229}
Original file line number Diff line number Diff line change @@ -17,4 +17,11 @@ public function addConstraints()
1717 $ this ->query ->where ($ this ->foreignKey , '== ' , $ this ->getParentKey ());
1818 }
1919 }
20+
21+ protected function getKeys (array $ models , $ key = null )
22+ {
23+ return collect ($ models )->map (function ($ value ) use ($ key ) {
24+ return $ key ? $ value ->getAttribute ($ key ) : $ value ->getKey ();
25+ })->values ()->filter ()->unique (null , true )->sort ()->all ();
26+ }
2027}
You can’t perform that action at this time.
0 commit comments