Domanda

I'm developing a larval package which has views.

How can I access images from my package in my view.

I've looked at the docs at it states you can move them to the public directory with:

php artisan asset:publish --bench="vendor/package"

Which I have done. But how can I access them in the view inside my package? Also, ideally I do not wish to run this command every time I update my assets, is there a way to just link to the public folder in the package workbench during development?

È stato utile?

Soluzione

They go in public/packages/[vendor]/[package]/, so you can refer to them as <img src="{{ asset('packages/vendor/package/image.png') }}">.

As for not having to republish, Laravel doesn't provide such a way, but yes you could, in development, set up a symlink between the directories, or set up a filesystem watching process (like Grunt can do) to automatically publish assets if you change something.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top