laraveltinker

Change Laravel Web Tinker Public Files Directory - Prevent 403 Error on Saving


I love this little library - so helpful.

However, it places some of its css and js files in a vendor folder inside the public directory of Laravel. I've got a Vendor class and paths in several apps and so, when saving a new Vendor, it redirects 403 Forbidden due to the conflicted vendor folder in the public directory.

I can't go back and refactor just for this to work, much as I like it.

It comes with a publishable config file, but I don't see an option to change the path to these files to a location outside the vendor folder. I don't want to make changes to the Spatie files, as this would just be overwritten upon next update.

Am I missing something easy here? Any way to get around this?


Solution

  • There isn't currently a config setting that allows you to control this.

    The line causing you grief is here - https://github.com/spatie/laravel-web-tinker/blob/master/src/WebTinkerServiceProvider.php#L29. It publishes the compiled assets, as you say, into the public/vendor folder.

    If you do not want to refactor your existing work, you can:

    1. PR/fork a change to add this as a config setting
    2. Manually change it on your end (although this could easily break if you republsihed the assets ever