Ensure Laravel feature is supported before using
This commit is contained in:
parent
cd9a43de7e
commit
dc8ec9ee1d
|
|
@ -215,10 +215,10 @@ class EloquentAdapter implements AdapterInterface
|
||||||
$query = $relation->getQuery();
|
$query = $relation->getQuery();
|
||||||
|
|
||||||
if (is_array($scope)) {
|
if (is_array($scope)) {
|
||||||
// Requires Laravel 8.15+
|
|
||||||
foreach ($scope as $v) {
|
foreach ($scope as $v) {
|
||||||
|
// Requires Laravel 8.15+
|
||||||
$adapter = $v['resource']->getAdapter();
|
$adapter = $v['resource']->getAdapter();
|
||||||
if ($adapter instanceof self) {
|
if ($adapter instanceof self && method_exists($relation, 'constrain')) {
|
||||||
$relation->constrain([
|
$relation->constrain([
|
||||||
get_class($adapter->newModel()) => $v['scope']
|
get_class($adapter->newModel()) => $v['scope']
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue