Boustrophedon
Boustrophedon
FFilament
Created by Boustrophedon on 5/8/2024 in #❓┊help
Show columns from relation on different connection?
I have tables that are related to each other on two different database connections (Integrating with a legacy system). For simplicity, say there is Users on one connection and Posts on the other. They are in a hasMany relation by Users.id and Posts.user_id. The Post model has
public function User(): BelongsTo {
return $this->belongsTo(User::class, 'id', 'user_id');
}
public function User(): BelongsTo {
return $this->belongsTo(User::class, 'id', 'user_id');
}
and the User model has
public function Posts(): HasMany {
return $this->hasMany(Post::class, 'id', 'user_id');
}
public function Posts(): HasMany {
return $this->hasMany(Post::class, 'id', 'user_id');
}
In the PostResource table() I have a column
Tables\Columns\TextColumn::make('User.name')
Tables\Columns\TextColumn::make('User.name')
I am not seeing the name of the User, nor any errors. Is it possible to show relationships over different database connections? The User and Post tables each do show their own data properly. Am I doing something wrong in general? Do I need a RelationshipManager? That seems overkill for just showing an item from the relation, I don't want to manage/edit/attach/detach/do other relationship operations.
8 replies