F
Filament2mo ago
emil

InteractsWithRecord + Clusters = Not possible?

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';
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;
}
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
GET|HEAD user/{tenant}/cluster/{service}/page
View looks like this
<x-filament-panels::page>
{{ $this->form }}
</x-filament-panels::page>
<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].
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?
6 Replies
emil
emilOP2mo ago
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();
$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. ^ Bump
Dennis Koch
Dennis Koch2mo ago
InteractsWithRecord probably needs $record. You defined $service though,. return '{record}/page';
emil
emilOP2mo ago
Already tried that sadly, meaning replaces all "service" with $record and modiifed mount function in various ways
Dennis Koch
Dennis Koch2mo ago
Where is the error thrown? I see it’s from the route not from the mounting. So there aren’t enough arguments passed somewhere
emil
emilOP2mo ago
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. @Zep Fietje 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.
Zep Fietje
Zep Fietje2mo ago
Happy to help debugging on a session 👍

Did you find this page helpful?