diff --git a/src/Http/Controllers/AttachController.php b/src/Http/Controllers/AttachController.php index 037c13f..124534c 100644 --- a/src/Http/Controllers/AttachController.php +++ b/src/Http/Controllers/AttachController.php @@ -43,7 +43,7 @@ public function getAvailableResources($request, $relationship) $query = $field->resourceClass::newModel(); - return forward_static_call($this->associatableQueryCallable($request, $query), $request, $query)->get() + return (forward_static_call($this->associatableQueryCallable($request, $query), $request, $query) ?? $query)->get() ->mapInto($field->resourceClass) ->filter(function ($resource) use ($request, $field) { return $request->newResource()->authorizedToAttach($request, $resource->resource);