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
Users
on one connection and
Posts
Posts
on the other. They are in a hasMany relation by
Users.id
Users.id
and
Posts.user_id
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()
table()
I have a column
Tables\Columns\TextColumn::make('User.name')
Tables\Columns\TextColumn::make('User.name')
I am not seeing the
name
name
of the User, nor any errors. Is it possible to show relationships over different database connections? The
User
User
and
Post
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.