Instanciar files in L5 Modular - Laravel 5

0

Through the "artem-schander / l5-modular" library: "dev-master" [ link installed in the composer json, I am adjusting my project to be modular and not mix everything in it (see folder Modules / Reports in the image). Everything works correctly but I would like my JS, CSS and AJAX files to be inside the same module (In this case Reports ) so I decided to create the public folder and within it the respective folders of js, css and ajax but I can not from the views instantiate the files js and css

I tried with

{!! Html::script('../../app/Modules/Informes/public/js/visorinforme.js'); !!}

Leaving from the public folder in the root and entering public in the module or

<script src="../public/js/visorinforme.js"></script>

But with none of them works for me. I would like to know if the files that are originally in the public folder of the root should remain there or if I can move them to the public folder in the new modular structure.

    
asked by Santiago Muñoz 17.08.2016 в 00:24
source

1 answer

0

No I think you can move them, the idea of Laravel is to isolate the public folder from the other folders that contain the important code for security, that way you move all the source code of your application outside the visible directory to the public and leave the static resources (css, js, images, etc.) and the point of entry (index.php) accessible.

In Illuminate \ Foundation \ Application this path is specified using the publicPath () method:

/**
 * Get the path to the public / web directory.
 *
 * @return string
 */
public function publicPath()
{
    return $this->basePath.DIRECTORY_SEPARATOR.'public';
}

Which is why I think you can only have a public folder, unless you do an important extension of the Laravel code, which I would not advise.

    
answered by 17.08.2016 / 00:45
source