I have noted people using asset() around links to styles and such in views?
What does this asset(...) function do? I cannot find it defined in 5.1? But it pops up in earlier docs in Helpers. There is no real documentation for what it does or its arguments and return values. PHPStorm can resolve file paths, I have an assets directory in my public dir. So my views look like this, if I use a bad path or file it gets flagged:
It will generate a valid URL for an asset. From your code, it is OK when you host your application in root of the domain (http://www.example.com/). But if you host it in a sub folder as http://www.example.com/app/ Then your asset file attempts to load from root and will fail, but using asset() function always create application related URL.
@mstnorris Yes. Got that. Thank You. I have noticed people creating sub-folders under there server roots? I always a create virtual host for my Laravel install make public the root dir of the host. Then I have multiple Laravel projects on one server. Since Laravel is so folder centric, seemed to be the best way?
@jimmck you can of course run multiple apps on the same server, but you'd use nginx configuration to do the mapping. from inside your project, those helpers will return the correct paths so you don't have to worry about it.
@mstnorris I keep every thing relative to the virtual host root. Each 'server host version' gets sym-linked from an 'apps' dir. But I get what you are saying. Need to be able to move builds from physical boxes quickly.
@mstnorris My one wish for Laravel is documentation of these functions. They do not list the arguments and expected results. And it takes time dig through the code to find out what it does. There are several mixed versions of asset() in the code. But I know I am guilty of the same thing.
I always ask myself "what would I want in an ideal world", I know it is what Jeffrey uses all the time. If you feel the docs are lacking, then fork them, modify what you feel is needed and submit a pull request.
With regards to what you want, find something you like and stick with it.
@pmall Parameter dumps are not really what I am looking for. Which is my point. If everyone has to read the source code it will hinder adoption of the library. Of course it will do wonders for Long Term Service agreements ! :)