Closed flatcapco closed 2 months ago
I can’t think an easy way to implement it, but if you got , I would accept it. 👍
Ok i'm not sure if this is mental or not... but if we use the route helper to start the process we could handle it with something similar to generate the string that we pass to the table.. this means that phpstorm or other ides would still recognise the route() input which i think solves the issue.
$client_id = 0;
$contact_id = 0;
$fullUrl = route("office.clients.contacts.edit", [
"client" => $client_id,
"contact" => $contact_id
]);
$relativeUrl = str_replace(url("/"), "", $fullUrl);
// Replace the parameters in sequence, ensuring the client_id and contact_id are replaced correctly
$relativeUrl = preg_replace(
"/\b" . $client_id . "\b/",
"{client_id}",
$relativeUrl,
1
);
$relativeUrl = preg_replace(
"/\b" . $contact_id . "\b/",
"{contact_id}",
$relativeUrl,
1
);
$relativeUrl outputs /office/clients/{client_id}/contacts/{contact_id}
So we can then pass that to the table.
OR if we pass in something like :route="route("office.clients.contacts.edit", [ "client" => 0, "contact" => 0 ])"
we can then do the relative processing within the table like you do with the rows?
Could you give a try on this PR #595 Please, let me know if it is ok.
@robsontenorio perfect Rob thanks so much
When defining a table link we use a string that gets extracted and pulls the variables from each row which is really nice.