Laravel-Backpack / basset

Better asset helpers for Laravel apps.
MIT License
155 stars 11 forks source link

Changed to relative paths to avoid errors with the APP_URL #68

Closed promatik closed 1 year ago

promatik commented 1 year ago

This aims to fix https://github.com/Laravel-Backpack/CRUD/issues/5127.

It's not the ideal fix, but this will avoid the usage of APP_URL by asset().

Generated paths are now relative; image

Side note; @pxpm I'm happy to tell you that this PR also fixes the last double slash issue 😅


Why isn't this the ideal fix?

Because this may cause issues for developers running Laravel inside a folder, having APP_URL set to http://localhost/myapp, paths should be like http://localhost/myapp/style.css but will be /style.css instead. Since the browser will try to fetch them from the website root, it falls back to http://localhost/style.css that does not exist.

Is there a solution for those cases?

Yes! Those extreme cases can disable the relative paths on configs or env.