Redirecting to URL from selected option

I'm working on a custom page where users can select a project from a dropdown list. When a project is selected, I need to redirect the user to a to the project selected;but for some reason it's not working. Here is my code:
class Board extends Page implements HasForms
{

use InteractsWithForms;
.....
public function mount(): void
{
$this->form->fill();
}

protected function getFormSchema(): array
{
return [
Card::make()
->schema([
Grid::make()
->columns(1)
->schema([
Select::make('project')
->label(__('project.title'))
->required()
->searchable()
->live()

->options(fn() => Project::pluck('title', 'id')->toArray())
->afterStateUpdated(fn() => $this->search())

,

]),
]),
];
}

public function search(): void
{
$data = $this->form->getState();
$project = Project::find($data['project']);

$this->redirect(route('filament.pages.RoadMap/{project}', ['project' => $project]));

}
class Board extends Page implements HasForms
{

use InteractsWithForms;
.....
public function mount(): void
{
$this->form->fill();
}

protected function getFormSchema(): array
{
return [
Card::make()
->schema([
Grid::make()
->columns(1)
->schema([
Select::make('project')
->label(__('project.title'))
->required()
->searchable()
->live()

->options(fn() => Project::pluck('title', 'id')->toArray())
->afterStateUpdated(fn() => $this->search())

,

]),
]),
];
}

public function search(): void
{
$data = $this->form->getState();
$project = Project::find($data['project']);

$this->redirect(route('filament.pages.RoadMap/{project}', ['project' => $project]));

}
Thanks
1 Reply
DrByte
DrByte11mo ago
What route is generated before the call to redirect()? Are you sure that part is working?
Want results from more Discord servers?
Add your server