Hung Thai
Hung Thai
FFilament
Created by Hung Thai on 2/20/2025 in #❓┊help
Displaying Relationship Records in Filament Table instead of Owner Model's resources
Hi, I'm having a problem with my custom Table display. For ex: I have 2 Models: "Product" & "Order", which has belongsToMany to each other as their relationship, and using "OrderProduct" pivot model to store their pivot data. I created the "OrderResource" as normal, and I want to display the list of OrderProduct in this Resource Table rather then the default Order model as usual, and why I click to the record, it will point me to the create/edit OrderResource. How can I archive this? I have tried the $table->query(OrderProduct::query()) method, but as soon as I clicked on the record, it throw the error as Order Resources Form contained the relationship to the OrderProduct pivot model. Hope you guys understand what i'm trying to say. Thank you!
6 replies
FFilament
Created by Hung Thai on 10/17/2024 in #❓┊help
How can I get the parent Resource from RelationManager class?
Hi. I'm having a UserResource class, which has the ContactRelationManager. In the Create/Edit/List pages of the UserResource, I can use method like: self::getResource() to point to the UserResource class. So, from the ContactRelationManager class, how can I get the full path of the UserResource class? Thanks.
6 replies
FFilament
Created by Hung Thai on 9/19/2024 in #❓┊help
Display Table info with Recursive Relationship
Hi. I'm having hard-time trying to display nested relationship in the table. For example, these 2 Models: Category: public function products() { return $this->hasMany(Product::class); } and Product: public function category() { if ($this->parent) { //recursive to get the root category return $this->parent->category(); } return $this->belongsTo(Category::class); } public function parent() { return $this->belongsTo(Product::class); } And then I had: - Category id = 1 which had Product id = 1 as it's child. - Product id = 1 which had Product id = 2 as it's child. I can play around in tinker and extract the category from Product id 2 like: \App\Models\Product::find(2)->category , but somehow on the table, the relationship category of Product id 2 return null. My column like: Tables\Columns\TextColumn::make('category.name') Product 1 show the category just fine, Product 2 just returned null. How can I fix this? Thank you.
2 replies
FFilament
Created by Hung Thai on 9/10/2024 in #❓┊help
Call modal record view from anywhere.
Hi there. I really appreciate the hard work of the creators and every one who contributed for this amazing package. I'm curious how can I call the modal infolist from anywhere in the app? For example: I have the public static function infolist inside my PostResource to open a modal view. How can I create an url/link inside Dashboard page to show the infolist modal for post id 1? I know how to create a url redirect to a full-page, but haven't found out how to create a url to call the infolist modal. Thank you so much.
14 replies