Pass array as parameter in Resource::getUrl

Is it possible? I need to pass the $record that has an Id and the $formulario has other Ids, they'ew connected by a pivot table since they have a many to many relationship. Just want to add that I'm a begginer in php . my code:
return CargoResource::getUrl('form', ['record' => $cargo->id, 'formulario' => $formulario]);
return CargoResource::getUrl('form', ['record' => $cargo->id, 'formulario' => $formulario]);
error returned: Missing required parameters for [Route: filament.admin.resources.cargos.form] [URI: admin/cargos/{record}/mount/{formulario}] [Missing parameters: "id":4, "id":9, "id":33, "id":34].
5 Replies
hosmar27
hosmar27OP4mo ago
this is the $formulario query:
$formulario = Formulario::query('ativo', true)->whereIn('id', $formularioId)->get('id');
$formulario = Formulario::query('ativo', true)->whereIn('id', $formularioId)->get('id');
hosmar27
hosmar27OP4mo ago
it returns the correct ids
No description
No description
hosmar27
hosmar27OP4mo ago
If needed more information I can show it
awcodes
awcodes4mo ago
Nested relationships don’t really work natively in filament until v4. But do you need formulario in the url. Couldn’t you use the relationship on cargo to get them? Path segments aren’t going to work with arrays either. If you need an array then it will need to be a query parameter.
hosmar27
hosmar27OP4mo ago
I'll try it, thank you for helping
Want results from more Discord servers?
Add your server