How could you use HasOneThrough relationships? #1357
Unanswered
bluewhiskeywhisper
asked this question in
Q&A
Replies: 1 comment 6 replies
-
Okay, let's do a couple of quick tests to see what's going on here shall we :) I'm suspecting that some of your posts don't have a person. You could do a withWhereHas if you only want to return Posts that have a Person associated, otherwise you'll need to either: Use the built-in capability from Laravel to return a "default" value where a relation doesn't exist, or set some null values using the approach below:
Feel free to jump in the Discord, as I'm on there more often btw https://discord.gg/mkmEfq7hUC |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I'm trying to utilise a
HasOneThrough
relationship in my table. I have managed to get aHasOne
relationship to work but I'm not able to get it working when applying a similar approach; I get this exception:Rappasoft\LaravelLivewireTables\Views\Column::setTable(): Argument #1 ($table) must be of type string, null given, called in Test_Project/vendor/rappasoft/laravel-livewire-tables/src/Traits/Helpers/ColumnHelpers.php on line 26
I'm not quite sure what that means. My Post model has a relationship to Person via the Edit model:
I have pulled in the person relationship into my builder:
I tried to reference
person.name
but it throws the above exception.I also have
$this->setEagerLoadAllRelationsStatus(true);
Any help or suggestions would be greatly appreciated. Thank you. :)
Using: dev-v3-master (4250511), PHP 8.2.10, and Laveral 10.23.1.
Beta Was this translation helpful? Give feedback.
All reactions