I am getting this error:
Error: Ziggy error: route 'contract/generatePDF?id=517&pickupKM=0' is not in the route list.
but is defined in the web.php: GET|HEAD contract/generatePDF
Route::get('contract/generatePDF', [App\Http\Controllers\ContractController::class, 'generatePDF'])->name('contract.generatePDF');
and from the vue I am calling this function:
router.visit(route("contract/generatePDF?id="+props.contract.id+"&pickupKM="+pickupKM));
also tried like this:
router.visit("/contract/generatePDF?id="+props.contract.id+"&pickupKM="+pickupKM);
Ziggy expects a route name that matches one of your Laravel-side routes. Query parameters are passed separately; they are not part of the route's name.
https://github.com/tighten/ziggy#query-parameters
Your issue is two-fold; you're giving Ziggy the route's URL (
contract/generatePDF
) instead of its name (contract.generatePDF
), and you're including the query string in the name, which Ziggy doesn't automatically parse out for you.