Closed p4rad0xus closed 7 months ago
@p4rad0xus Did you try to include competitionType.name
in the select in the query builder?
e.g.
Competition::query()
->select('competition.*')
->select('competitionType.name')
->joinRelationship('competitionType')...
Actually, nevermind this comment. Something seems off, but I believe it's in the Splade package itself. What version of power joins do you have installed, and what version of Splade?
Yeah, the package implementation is intended to work with power joins version 2.*. Version 3 doesn't work with the current implementation. Try to downgrade to 2 (you could hit version constraints), but then it should work. I'll try to work with the Splade team to add version 3 support.
I'm closing the issue for now, but feel free to re-open.
I use Laravel Splade for a web project. To display the data from a database table I use the functionality of SpladeTable. The query is generated using
joinRelationship()
.The SpladeTable documentation explains how to sort by relationship column. When I want to use this and trigger the sorting, I get the following error:
To order the query using a column from a relationship, make sure the Model uses the 'PowerJoins' trait.
However, the use of the trait is stored in the models.
The query builder:
Competition::joinRelationship('competitionType')
Configuration of the SpladeTable:
The models:
Do I have to use the trait in a different way in the model?