#InteractsWithRecord + Clusters = Not possible?

12 messages · Page 1 of 1 (latest)

jade sedge
#

Using custom Filament page (\Filament\Pages)
Page is within a Cluster.

What I want to achieve:
Having user/{tenant}/cluster/{model}/page work - working with a specific record in a custom Page, where the Page is inside a Cluster.

On the Cluster class, I define slug:

protected static ?string $slug = 'cluster';

On the Page class, I define this:

use InteractsWithRecord;
public Service $service;

public static function getRoutePath(): string
{
    return '{service}/page';
}
public function mount(Service $service): void
{
    $this->service = $service;
}

php artisan route:list declares this:

GET|HEAD   user/{tenant}/cluster/{service}/page 

View looks like this

<x-filament-panels::page>
    {{ $this->form }}
</x-filament-panels::page>

I get the error:

Missing required parameter for [Route: filament.user.cluster.pages.{service}.page] [URI: user/{tenant}/cluster/{service}/page] [Missing parameter: service].

If I set getSubNavigation to return an empty array (the breadcrumbs), I get the page to render.

What am I missing - feels like I'm over-complicating this?

strong saffronBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

jade sedge
#

Page seems to use HasSubNavigation, which calls the function generateNavigationItems.

If it's not a resource page, parameters are not sent through


            $pageItems = $isResourcePage ?
                $component::getNavigationItems($parameters) :
                $component::getNavigationItems();

Overriding getUrl() in the Page class is also a no-go because it is static and has no context action.

There's something I'm overlooking but can't figure out what.

jade sedge
#

^ Bump

trail swift
#

InteractsWithRecord probably needs $record. You defined $service though,.

#

return '{record}/page';

jade sedge
trail swift
#

Where is the error thrown? I see it’s from the route not from the mounting. So there aren’t enough arguments passed somewhere

jade sedge
#

It's from HasSubNavigation which is part of x-filament-panels::page.
Specifically the function generateNavigationItems

#

And what I believe to be the "current page" url in the breadcrumbs that is not receiving the record

#

If it's a bug I'm happy to PR it - but I think I am overlooking something as I'm sure many have done this previously.

jade sedge
#

@pine lotus Is this something you can help with if I pay the £200 consultation fee?

I simply want to edit a record on a custom Filament page, that is within a Cluster and uses the standard x-filament-panels::page in the view.