Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource extending in cluster does not register resource pages routes under the clusters panel #14093

Open
TKrisee opened this issue Aug 29, 2024 · 0 comments
Labels

Comments

@TKrisee
Copy link

TKrisee commented Aug 29, 2024

Package

filament/filament

Package Version

v3.2.108

Laravel Version

v10.48.20

Livewire Version

v3.5.6

PHP Version

PHP 8.3

Problem description

I'm not exactly sure how to describe this but I'll try my best.

When I'm extending a filament Resource class that is under namespace "App" from a resource class that is under "AppTest" and register it in my panel everything works as expected. Hovewer, when I try to extend the same resource that is in a cluster the routes for the pages (list, edit, create etc) are not registered for the panel under "AppTest"


This is the resource I'm trying to extend, mind you this resource is not registered with any panels
app/Filament/Resources/TagResource.php

<?php

namespace App\Filament\Resources;

use App\Filament\Resources\TagResource\Pages;
use App\Models\Tag;
use Filament\Resources\Resource;

class TagResource extends Resource
{
    protected static ?string $model = Tag::class;

    public static function getPages(): array
    {
        return [
            'index' => Pages\ListTags::route('/'),
            'create' => Pages\CreateTag::route('/create'),
            'edit' => Pages\EditTag::route('/{record}/edit'),
        ];
    }
}

This is where I'm trying to extend it
apptest/Filament/Clusters/Settings/Resources/TagResource.php

<?php

namespace AppTest\Filament\Clusters\Settings\Resources;

use App\Filament\Resources\TagResource as BaseTagResource;
use AppTest\Filament\Clusters\Settings;

// This will throw an error beacuse of the missing routes
class TagResource extends BaseTagResource
{
    protected static ?string $cluster = Settings::class;
}

Expected behavior

I'd expect that resource classes under clusters behave the same way when they are not in a cluster regarding class extending.

Steps to reproduce

  • clone the repo and create a database.sqlite file under the database folder
  • run php artisan migrate
  • open upp app, log in ( [email protected] / password ), navigate to path /test/settings/tags
  • you'll receive the following error Route [filament.test.resources.tags.index] not defined.

look for FBUG: in the provided repo to play around

Reproduction repository (issue will be closed if this is not valid)

https://github.com/TKrisee/filament-bugs

Relevant log output

Route [filament.test.resources.tags.index] not defined.

Donate 💰 to fund this issue

  • You can donate funding to this issue. We receive the money once the issue is completed & confirmed by you.
  • 100% of the funding will be distributed between the Filament core team to run all aspects of the project.
  • Thank you in advance for helping us make maintenance sustainable!
Fund with Polar
@TKrisee TKrisee added bug Something isn't working medium priority unconfirmed labels Aug 29, 2024
@TKrisee TKrisee changed the title Resource extending in cluster does not register resource pages routes under current panel Resource extending in cluster does not register resource pages routes under the clusters panel Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

1 participant