F
Filament5d ago
Luiz

ListCategoryPage stuck on Product model instead of Category

I’m hitting a snag: in my ProductResource the default pages (ListProduct, EditProduct, CreateProduct) work fine. I added a new ListCategoryPage to show ProductCategory under the same resource, but it still uses the Product model and lists products instead of categories. I’ve tried tweaking getModel(), mount(), even registered the page in the Resource correctly, but nothing makes it use ProductCategory. Anyone run into this or know if you can have a page with a different model inside a Resource? Any pointers would be awesome, thanks!
Solution:
I created a new resource and hid it from the navigation menu. It wasn't what I wanted but I had no other way.
Jump to solution
7 Replies
Dennis Koch
Dennis Koch5d ago
What’s the code of your ListCategoryPage?
Luiz
LuizOP5d ago
but the category list is not related to a specific product. the same as ListProduct. However, I try to change the model in getModel() or in $model and it continues to use the resource model.
Dennis Koch
Dennis Koch4d ago
I'd try overwriting $table->query(fn () => ListCategory::query())
Luiz
LuizOP4d ago
and about the create and edit form?
Dennis Koch
Dennis Koch4d ago
You need to overwrite the the ->form() method on both pages. But sounds like you rather want another Resource in that case
Solution
Luiz
Luiz20h ago
I created a new resource and hid it from the navigation menu. It wasn't what I wanted but I had no other way.

Did you find this page helpful?