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:
Pastebin
Action to redirect from one panel to another - Pastebin.com
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.
27 Replies
Are you sure the games are in different panels? If you want to go to different panels you just do:
Thanks for the help. I'll test it out ASAP.
I tried to chain it in the action but it didn't work.
It gives this error: Property 'NebulaInstanceResource' not found in \Filament\Tables\Actions\Action
I've tried it a few other ways and places, but same issue. I'm wondering if I broke something fundamental somewhere else.
Becauuse it's wrong you should do:
Still not working (including variations). I'm more suspicious that I've broken something somewhere or have a fundamental logic and or understanding flaw. I'd be open to a recommendation for reasonably priced paid help.
Feel free to DM me so I can understand in more detail what you are tyring to achieve
Could you explain what target you want to redirect to?
The User is on their /admin page, which shows the NebulaInstances they are involved in. When they click on a NebulaInstance (action button), it should take them to a new panel (in this context the Game panel). The Game panel will have all the resources for that specific game/instance (key people, ships, etc.). That is why I need to bring over the NebulaInstance reference as well, so they only see the relevant records for that Instance.
->url(\App\Filament\Game\Resources\NebulaInstanceResource::getUrl('index', panel: 'game'))
?\App\Filament\Resources\NebulaIstanceResource
are you sharing this resource to the panels?
I didn't understand what/where is the target 🤷♂️
I'm not sure what that means. I do have the discoverPages and Resources set up.
The target is a new page (a new dashboard I believe, even though I'm using the default dashboard). Basically I envision it as a new "admin" panel. The general one for the user. Then another panel with all the information for a specific instance for the game.
Sorry if my knowledge level makes this more difficult--Filament is wonderful but I'm still learning to code and use it.
I do have the discoverPages and Resources set up
same path to both panels?
Yes. Do I need to set up separate directories?
I think this was supposed to work
what is the url for accessing this action?
/admin/nebula-instances
Is it redirecting to the game panel?
hum, weird
I may have messed up a fundamental some where. That is where it may be beneficial to have someone look at my code. I've tried so many ways who knows what damage I've done! 🙂
are you able to create a minimal project on github, with panels and one resource, to reproduce this issue? I can take a look
I have it pushed to gitub, including seeders.
Just set public, here is the link:
https://github.com/House-Chaos-Games/ChaosEmpire
GitHub
GitHub - House-Chaos-Games/ChaosEmpire
Contribute to House-Chaos-Games/ChaosEmpire development by creating an account on GitHub.

This error (which I've gotten frequently during this process):
foreach() argument must be of type array|object, string given
GET localhost
PHP 8.3.9 — Laravel 11.16.0
Expand
vendor frames
24 vendor frames collapsed
storage/framework/views/4943bc92ebba41e8b0e508149542e0ad.blade.php
:16
require
62 vendor frames collapsed
public/index.php
:17
require_once
1 vendor frame collapsed
storage/framework/views/4943bc92ebba41e8b0e508149542e0ad.blade.php :16
$env->slot($name, attributes: $slot->attributes->getAttributes());
echo $slot->toHtml();
$env->endSlot();
}
?>
@endcomponent
this is not related to the issue I think
It happens when I click on the button. Maybe I messed something up earlier in the process. I wonder if that view is delectable (without breaking something else)?
probably
you need to inspect your code
this isn't related to the main issue
So many hours.... hahahaha
I really appreciate your help. I've done business coaching and consulting for 40 years so if you need any business help I'm at your service! (this applies to you as well @toeknee )
thanks ✌️