Need Help, how pass parameters to relation manager?
here my table action
->actions([
Tables\Actions\ViewAction::make()->url(fn($record) => RkupResource::getUrl('view', ['record' => $record->id, 'periode' => Carbon::parse(request()->get('tableFilters')['periode']['date'] ?? now())->endOfMonth()->format('Y-m-d')])),
Tables\Actions\EditAction::make()->url(fn($record) => RkupResource::getUrl('edit', ['record' => $record->id, 'periode' => Carbon::parse(request()->get('tableFilters')['periode']['date'] ?? now())->endOfMonth()->format('Y-m-d')])),
])
here my custom pages
public static function getRelations(): array
{
return [
RelationManagers\ProjectsRelationManager::class
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListRkups::route('/'),
// 'create' => Pages\CreateRkup::route('/create'),
'view' => Pages\ViewRkup::route('/{record}/{periode?}'),
'edit' => Pages\EditRkup::route('/{record}/{periode?}/edit'),
];
}
I need periode on my relationManager.
Solution:Jump to solution
Solve with this.
on resource
public static function getRelations(): array
{
return [...
1 Reply
Solution
Solve with this.
on resource
public static function getRelations(): array
{
return [
RelationManagers\ProjectsRelationManager::make([
'periode' => request()->route('periode') ?? now()->endOfMonth()->format('Y-m-d')
])
];
}
On RelationManager
public ?string $periode;
public function table(Table $table): Table
{
dd($this->periode);
}