Skip to content

Cannot make multiple resource filtered by getEloquentQuery with same model  #5071

Description

@ayranxs

Package

filament/filament

Package Version

22.16.52

Laravel Version

9.3.10

Livewire Version

No response

PHP Version

8.1

Problem description

When you create two resources with different labels for same model, it treats as one resource.

For example; when you have Orders model and instead of just showing Orders menu then letting user to use filters to get Pending/Completed orders, you may want to leverage getEloquentQuery on resources to automatically filter out by order state. So this way, you can have Pending Orders / Completed Orders menu.

In Nova, you can create multiple resource for same model, then you can give each other different label and voila; they're added to navigation

Expected behavior

For example, when you have Order model and you created PendingOrdersResource with custom $label (Pending Orders) & CompletedOrdersResource with custom $label (Completed Orders), they should be listed on the navigation as two seperate resources. Instead you'll see two Orders menu on the navigation, when you click on each other, you'll see that the URI is same on them (/admin/orders)

Steps to reproduce

Create a Order model,
Create PendingOrders and CompletedOrders resource,
Give each resource a different label

Reproduction repository

https://github.com/ayranxs/filament

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions