codezero-be / laravel-localized-routes

⭐️ A convenient way to set up and use localized routes in a Laravel app.
MIT License
491 stars 45 forks source link

WIP - Support Livewire #93

Open ivanvermeyen opened 1 year ago

ivanvermeyen commented 1 year ago

Support Livewire (#58)

Attempt to create a fresh Request from the current URL.

If this works we can pass Livewire::originalUrl() when the {locale}/livewire/message/{name} endpoint is accessed.

Unfortunately Livewire::originalUrl() does not include the query string.

gwleuverink commented 1 year ago

This looks great @ivanvermeyen! That should probably do it

I'll swap this for my hacky workaround and see if I run in to any compatibility issues

I can make some time to get back into it somewhere next week 👍🏻

tomas-doudera commented 7 months ago

Hello, do you plan to add PR to package? I have same problem with livewire.

ivanvermeyen commented 7 months ago

Hello, do you plan to add PR to package? I have same problem with livewire.

Because I don't use Livewire myself, I'm a bit hesitating to merge this. I can't easily test it and assure that it is working.

However, if you want to try this, you can just download the updated SetLocale middleware and use that instead of the one in the main repo. It has not been tested with Livewire 3 though.

https://github.com/codezero-be/laravel-localized-routes/blob/d7b92c5f57e99608802a99e5ccea0f62e2453350/src/Middleware/SetLocale.php

ianfortier commented 6 months ago

Same problem with Livewire