Search code examples
laravellaravel-5.3

need advice on laravel js and css storage directory


Hi all i have started using laravel mvc week ago. i have builded websites in php so m good in php. i want advise regarding laravel mvc . is that safe security wise storing script and css files inside public folder. if No what is alternate?

and one more thing i want to know how to include css and js files form master files & child views ? how to make master file js execute first before child view scripts executes ?

whats vue while learning laravel i came through this will this come into picture in my case?


Solution

  • It's perfectly safe. All static files goes in public folder if you are going for vcs hosting type. Otherwise you can use shared hosting and put all the contents of public directory out and delete public directory all together thereby removing all cases of hacking your public directory.

    For including in your views, you can use the static_url method provided by laravel. You can follow this blog

    Laravel also provides facades which you can define and can use for further structuring.