FilamentF
Filament11mo ago
Randak

Action to redirect from one panel to another

My Admin Panel lists a User's current nebula_instances. When I click on a specific nebula_instance I want to redirect to the game panel and retain the nebula_instance_id. I've tried many ways (some versions in Pastebin commented out), but can't get it to work. My current error when clicking a nebula_instance is:
foreach() argument must be of type array|object, string given

Any guidance, direction, an open source project that does this, would be appreciated. I am a coding novice. Thanks.

Pastebin for the full files:
https://pastebin.com/W5fsJXic#hJGUz6WJ

Some select file info that hopefully provides the answer:

Standard panels (no dashboard):
Admin
Game

From the NebulaInstanceResource:
            ->actions([
                    Action::make('viewGame')
                        ->label('Enter Game')
                        ->icon('heroicon-o-play')
//                        ->action(function (NebulaInstance $record) {
//                            session(['nebula_instance_id' => $record->id]);
//                            return redirect('/game');
//                        }),

                        ->url('/game')
                        //->url(fn (NebulaInstance $record) => url('/game?nebula_instance_id=' . $record->id))
                        ->openUrlInNewTab()
            ])
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Was this page helpful?