You cant. Php is generated before js. That means that the route function is run before your JS is even started.
You can use ziggy to get a js version of the route helper instead :)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi
My blade calls a js routine to save some invoice data, it returns those variables as:
In vuejs:
this.paymentid this.propertyid this.subtype
Convert to php:
$paymentid $propertyid $subtype
What i need to do (and I can see the js variables exist in my blade as I have div that shows v-if="paymentid > 0") is convert them from js to php.
This is so that I use a button to
{{ route('letter::select', [ 'sub_type => $subtype ]) {{
as I can't use
{{ route('letter:select', [ 'sub_type' => @{{ subtype }} ) }}
Thanks for any help! Cheers Carl.
Please or to participate in this conversation.