tighten / ziggy

Use your Laravel routes in JavaScript.
MIT License
3.91k stars 248 forks source link

Route with parameters not correct #524

Closed njwela closed 2 years ago

njwela commented 2 years ago

i have setup everything and when i use the route() in the js for routes with n parameters its working great but for those that do have parameters, they are renders incorrectly like

this: route('admin.orders.show',1) returns: https://office.app/og-admin/orders/%7B%7D?1=

Do you have an idea why that is?

bakerkretzmar commented 2 years ago

Can you share more info so I can help debug this please? Ziggy version, how you're integrating it, if you're using Vue or React or something else, an example route definition, your Ziggy configuration, etc. Thanks.

njwela commented 2 years ago

Hi there,

am using "tightenco/ziggy": "^1.4" on a Laravel installation

Have inserted the @route() in footer before any custom js

Am using Route::resource('/', OrdersController::class); which includes the admin.orders.show route and an ID as the parameter that can be passed.

Am using vanilla js

njwela commented 2 years ago

@bakerkretzmar managed to fix the error. My routes were all messed up :)

bakerkretzmar commented 2 years ago

Glad you got it sorted! 👍🏻