-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scope relationship options #4851
Conversation
Codecov Report
@@ Coverage Diff @@
## 1.4 #4851 +/- ##
============================================
- Coverage 60.37% 60.34% -0.04%
- Complexity 1370 1373 +3
============================================
Files 194 194
Lines 3990 3992 +2
============================================
Hits 2409 2409
- Misses 1581 1583 +2
Continue to review full report at Codecov.
|
I'm getting the following error in laravel.log, when I click any dropdown BREAD field related to a relationship (Add or Edit). The field says "the results could not be loaded". [2020-04-03 15:17:01] production.ERROR: Undefined property: stdClass::$scope {"userId":1,"exception":"[object] (ErrorException(code: 0): Undefined property: stdClass::$scope at [APPNAME]/vendor/tcg/voyager/src/Http/Controllers/VoyagerBaseController.php:860) |
Is $options an object in your case? Or just an empty string? |
I'm pretty new to php/laravel, I think $options is a json formatted string, which in my case doesn't have a scope property (yet). I commented out lines 860-862 in VoyagerBaseControler.php and I can see the dropdown contents again. Then I uncommented those lines and put in a scope property (empty string) into the relationship properties, and I can see the dropdown contents for that relationship (but not any others). Relationship details is now: |
!empty($options) should cover all cases without throwing an error, 0 is not used anyway. |
I think |
If we are sure |
Yes, there's an accessor in the datarow model decoding it. |
I also encountered this error just now. A fix that worked for me was editing line 860 in VoyagerBaseController and changing
to
|
Fixed |
This allows to use a local scope on the related model in a relationship.
Usage:
Create a scope, for example
and add to the relationship options:
Supersedes #4760