-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Add support for MorphOne relationships #844
Conversation
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Reopen, I still think this is relevant. |
thank you so much for finding this, you saved my day |
thank you for the change. |
@rappasoft What is necessary for this to be merged? Edit: Actually, whilst it does solve the error and retrieves the data, the sorting itself doesn't seem to work |
For anyone finding this, you can (as temporary solution) copy the version from this Pull Request into a new file. Then go to the use Rappasoft\LaravelLivewireTables\Traits\WithData;
use App\Traits\WithData as WithDataFixedUnsupportedMorph; And add the following in the $loader = AliasLoader::getInstance();
$loader->alias(WithData::class, WithDataFixedUnsupportedMorph::class); |
Tested against core, all appears working @rappasoft - this seems okay to commit |
Take the following relationship
Model
Address
, which has amorphTo()
method and hasaddressable_id
andaddressable_type
columns.Model
User
, which hasMorphOne()
that points to the address model.If I have a user table, and I want to display the street of the address, I would do
Column::make('street', 'address.street')
.This will give the following exception:
Rappasoft\LaravelLivewireTables\Views\Column::setTable(): Argument #1 ($table) must be of type string, null given, called in /Users/danielgebben/Documents/LenderSpender/platform/vendor/rappasoft/laravel-livewire-tables/src/Traits/Helpers/ColumnHelpers.php on line 24
.This is because MorphOne is not supported when making the columns.
All Submissions:
New Feature Submissions:
Changes to Core Features:
Not yet, I'd first like this to pass and then I'll add tests