laravel-enso/tables

readPath() problem when laravel runs in a subfolder

ClCfe opened this issue · 0 comments

ClCfe commented

This is a feature request.

Hello,

  • My laravel application is running in a subfolder: https://domain.tld/subfolder
  • My vueJS is outside the laravel application (but on same server)

when you use route($name, $parameters = [], $absolute = false) to retrieve a named route, it won't include the parent(s) directory(ies) (here, /subfolder/)

route($name, $parameters = [], $absolute = false) returns
readPath: "/users/tableData",
instead of
readPath: "/subfolder/users/tableData",

as a consequence, the vueJS front sends ajax to
https://domain.tld/users/tableData
instead of
https://domain.tld/subfolder/users/tableData

The problem occurs here:
https://github.com/laravel-enso/tables/blob/master/src/Services/Template/Builders/Structure.php#L99
https://github.com/laravel-enso/tables/blob/master/src/Services/Template/Builders/Filters.php#L39
https://github.com/laravel-enso/tables/blob/master/src/Services/Template/Builders/Buttons.php#L85

I see two solutions to solve this:

  • Let us configure the third parameter of route() to be $absolute=true instead of hard-coded false
  • Or, be able to force readPath in the template json

Thank you