-
Notifications
You must be signed in to change notification settings - Fork 163
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
Dependable MorphTo will not work correctly (again) #85
Comments
@wize-wiz I am not using a BelongsTo, but a MorphTo field. There is no third parameter that i'm aware of. This is the piece of code (a bit simplified): $fields[] = NovaDependencyContainer::make([
Fields\MorphTo::make(__('Orglevel'), 'org_level')
->types([
\App\Nova\Client\Department::class,
\App\Nova\Client\Location::class
])
->onlyOnForms()
])->dependsOn('user_type', (string) Enums\UserType::CLIENT_ORG_USER); |
@wize-wiz will check soon and confirm my findings. Die Niederländische sprache ist eine nette Geste, woher wusstest du das? |
@preliot I can smell you're Dutch from afar 😄 Ik ben geboren en getogen in Nederland 😉 |
@wize-wiz I gues it's that time again ... my yearly shower awaits me! |
Update to latest version and issue changed. Now i don't get an error, but no message in the frontend. My browser dev tools reveals a validation issue. I see this message in the xhr request:
So now it seems to be a validation issue. Org_level is still a morphTo and underneath are the form fields send to the application:
|
Yea I noticed, I'll push a fix soon when I'm done with some other issues. |
Unfortunatly, now i'm back at the original issue: Xhr request: {message: "Server Error"}
message: "Server Error" Laravel log file: [2019-10-25 09:02:50] local.INFO: 2019-10-25 09:02:50 | message: Class 'locations' not found | file: <source_dir>\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasRelationships.php | line: 720 | code: 0 |
@preliot I currently do not have any problems with the My current test version is a default setup from the Laravel documentation One To Many (Polymorphic) // this is resource `Comment` with table fields `commentable_id` and `commentable_type`
Select::make('Some Select', 'some_select')
->options([
'a' => 'A',
'b' => 'B'
])
->displayUsingLabels()
,
NovaDependencyContainer::make([
MorphTo::make('Commentable')->types([
Post::class,
Video::class,
])
,
Currency::make('Dependency Price', 'dprice')
,
NovaDependencyContainer::make([
Select::make('Depedenct Select', 'additional')
->options([
'a' => 'A',
'b' => 'B'
])
->displayUsingLabels()
->rules('required')
])
->dependsOn('commentable', 'Video')
])
->dependsOn('some_select', 'a') Could you give me a minimal database structure and resource/model setup and a static/translated version of the following? $fields[] = NovaDependencyContainer::make([
// what value is `__('Orglevel')
Fields\MorphTo::make(__('Orglevel'), 'org_level')
->types([
\App\Nova\Client\Department::class,
\App\Nova\Client\Location::class
])
->onlyOnForms()
// what value is `(string) Enums\UserType::CLIENT_ORG_USER`
])->dependsOn('user_type', (string) Enums\UserType::CLIENT_ORG_USER); |
@wize-wiz I've decided to move away from the issue. Still using this package, but this specific issue is no longer there. Thanks for all your efforts! |
I've recently updated to Nova 2.4.0 and issue #62 seemed to be resolved. I can select the client or department without any issue. However, when i try to save this resource I get an error:
When i leave out the dependable container, the fields work like expected. Problem is in this file:
When $class is set, the first time i see a real class path. Second time function is called, $class is set to 'plural name of resource' and a string is passed. Hence the error.
stacktrace:
The text was updated successfully, but these errors were encountered: