File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 5
5
use Illuminate \Database \Eloquent \Builder ;
6
6
use Illuminate \Database \Eloquent \Relations \BelongsTo ;
7
7
use Illuminate \Database \Eloquent \Relations \HasOne ;
8
+ use Illuminate \Database \Eloquent \Relations \MorphOne ;
8
9
use Rappasoft \LaravelLivewireTables \Views \Column ;
9
10
10
11
trait WithData
@@ -77,6 +78,7 @@ protected function joinRelation(Column $column): Builder
77
78
$ model = $ lastQuery ->getRelation ($ relationPart );
78
79
79
80
switch (true ) {
81
+ case $ model instanceof MorphOne:
80
82
case $ model instanceof HasOne:
81
83
$ table = $ model ->getRelated ()->getTable ();
82
84
$ foreign = $ model ->getQualifiedForeignKeyName ();
@@ -139,7 +141,7 @@ protected function getTableForColumn(Column $column): ?string
139
141
foreach ($ column ->getRelations () as $ relationPart ) {
140
142
$ model = $ lastQuery ->getRelation ($ relationPart );
141
143
142
- if ($ model instanceof HasOne || $ model instanceof BelongsTo) {
144
+ if ($ model instanceof HasOne || $ model instanceof BelongsTo || $ model instanceof MorphOne ) {
143
145
$ table = $ model ->getRelated ()->getTable ();
144
146
}
145
147
You can’t perform that action at this time.
0 commit comments