Replies: 2 comments 1 reply
-
I have nested resource |
Beta Was this translation helpful? Give feedback.
1 reply
-
I was able to do this using the For example, if you want to get the comments from the posts, and want to put them in a general comments resource: public function posts(): HasMany
{
return $this->hasMany(Post::class);
}
public function comments(): HasManyThrough
{
return $this->hasManyThrough(Comment::class, Post::class);
} In CommentResource: public static function getEloquentQuery(): Builder
{
return Filament::getTenant()
->comments()
->getQuery()
->select('comments.*')
->with(['post']) // Optional
->withTrashed();
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Package
Panel builder
Package Version
v3.3.5
How can we help you?
I have nested resource, and can get parent record data.
is there a way to get record in child ListRecords / Index page from child Resource?
Child Resource :
Child ListRecords :
======================================================================
Latest update successfully done :
Parent Resource :
Child Resource :
Child ListRecords :
Trait ( using Hashids https://github.com/vinkla/laravel-hashids ) :
Beta Was this translation helpful? Give feedback.
All reactions