filament icon indicating copy to clipboard operation
filament copied to clipboard

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

Open TKrisee opened this issue 1 year ago • 0 comments

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 avatar Aug 29 '24 16:08 TKrisee