Problems pasing parameters to pages in a plugin
I'm having trouble to pass parameters to a page my log viewer plugin.
I'm using Sushi as my 'record' so I cannot have a normal Filament resource
I have 3 pages
the main page that list the log files - works, no problem
the log file page that lists the entries in the log file - some how it works
the log file entry page that shows details of a log entry - does not work at all
all 3 pages is registered in the plugin like this:
In LogViewerPage I have a table, and this is how I generate the actions
in LogViewerViewLogPage the mount() throws an error
Unable to resolve dependency [Parameter #0 [ <required> $fileName ]] in class Rabol\FilamentLogviewer\Pages\LogViewerViewLogPage
the url looks like this:
any hint on what I'm missing ?
6 Replies
you're passing the fileName as query string not route parameters
I think it should be
/admin/log-viewer-view-log-page/worker.log
I'm doing like this:
it worked fine in V2
🤔
getUrl('index',['fileName' => $record->name])
no this is for resources, first parameter should be array
on a page
it is as if my page is not registered to accept parameters
@Dan Harrin how to register pages in a plugin so that it can accept parameters ?
in the packagePlugin
not where, but how
as I described above - I'm doing that
in a resource one can do this:
public static function getPages(): array
{
return [
'index' => Pages\ListUserDocs::route('/'),
'create' => Pages\CreateUserDoc::route('/create'),
'view' => Pages\ViewUserDoc::route('/{record}'),
'edit' => Pages\EditUserDoc::route('/{record}/edit'),
'details' => Pages\UserDocDetails::route('/{record}/details'),
'pdf' => Pages\UserDocPDF::route('/{record}/pdf'),
];
}
but not for pages as far as I can see