Sending data from a custom page to another custom page
Hello colleagues. I'm developing a survey application with Filament and I'm encountering the following problem.
I have two panels: adminpanel and employeepanel.
From the employeepanel, users access a custom page (ListSurveyEmployee) that displays a list of the surveys they need to complete.
In each of these records, I've created an ACTION called TAKE SURVEY. This is the code for my ACTION.
Action::make('makeSurvey')
->label('Realizar Encuesta')
->icon('heroicon-o-pencil')
->color('success')
->visible(function ($record) {
return $record->status === 'pendiente';
})
->url(fn ($record) => route('filament.employee.pages.create-survey-employee', ['survey' => $record->id]))
When the user clicks on this option, they are redirected to another custom page (CreateSurveyEmployee), where a form should be displayed with the fields to complete for the assigned survey.
The problem I'm having is that I don't know how to collect the ID of the survey the user wants to complete on the CreateSurveyEmployee custom page so I can then create the logic.
This is the custom page code that should collect the parameter.
class CreateSurveyEmployee extends Page
{
protected static bool $shouldRegisterNavigation = false;
protected static string $view = 'filament.employee.pages.create-survey';
protected static ?string $title = 'Realización de Encuesta';
public function form(Form $form): Form
{
return $form
->schema([
]);
}
}
Can anyone help me with this?
Thanks.
I have two panels: adminpanel and employeepanel.
From the employeepanel, users access a custom page (ListSurveyEmployee) that displays a list of the surveys they need to complete.
In each of these records, I've created an ACTION called TAKE SURVEY. This is the code for my ACTION.
Action::make('makeSurvey')
->label('Realizar Encuesta')
->icon('heroicon-o-pencil')
->color('success')
->visible(function ($record) {
return $record->status === 'pendiente';
})
->url(fn ($record) => route('filament.employee.pages.create-survey-employee', ['survey' => $record->id]))
When the user clicks on this option, they are redirected to another custom page (CreateSurveyEmployee), where a form should be displayed with the fields to complete for the assigned survey.
The problem I'm having is that I don't know how to collect the ID of the survey the user wants to complete on the CreateSurveyEmployee custom page so I can then create the logic.
This is the custom page code that should collect the parameter.
class CreateSurveyEmployee extends Page
{
protected static bool $shouldRegisterNavigation = false;
protected static string $view = 'filament.employee.pages.create-survey';
protected static ?string $title = 'Realización de Encuesta';
public function form(Form $form): Form
{
return $form
->schema([
]);
}
}
Can anyone help me with this?
Thanks.