-
Notifications
You must be signed in to change notification settings - Fork 65
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
BelongsToDepend doesn't support DisplayUsing despite inheriting from BelongsTo #93
Comments
Found a workaround. Set Note: I do not believe this to be particularly maintainable and I do not recommend doing this, but until base class function inheritance is rectified here's your workaround. BTW, I found another base class function that doesn't work |
Ha, yeah, very not maintainable. Having to do a |
And found a fix. If you're here in the future because you're searching for "laravel nova unkown column date_result" your issue is that you're using a select statement in your Actually... where's a Laravel Nova dev. Why is the Trends class using a select statement to add columns? If addSelect and selectRaw exist for this purpose why isn't trends (and probably other classes) using them for this purpose? Just curious. |
I've been implementing BelongsToDepend into an existing Nova site to ensure admin users can't mix up records associated with different customers. Eg select a company and have it filter client records to just that companies clients.
However, for whatever reason, I can't get any version of
->displayUsing()
to work, it doesn't error it just does nothing. This is pretty critical as the code is currently hardcoded to usepublic static $title
for the descriptions in the dropdown which only supports one field. I am dealing with client first name and last name columns that need to be combined for display which can't be done within $title because of the rules of static I guess, and I have another data class whose description is actually derived from one of its associated classes.Now, I have seen other documentation that says I can use
public function title()
in my Nova/*.php in lieu of$title
however... it doesn't work for BelongsToDepend for some reason. Now I've been digging through the PHP file for this field and I can't figure out where I would even begin to insert a patch for this to make it work. Weird thing is, the PHP file says,class NovaBelongsToDepend extends BelongsTo
I was under the impression from my experience that when you extend a class you're not supposed to be able to break base class functions, override and modify the outcome sure but... not completely break. And this PHP file doesn't have an override from the original DisplayUsing function declaration so... what's gone wrong, and what can I do to help fix it?The text was updated successfully, but these errors were encountered: