3

In Laravel 4 my public directory is my template storage such as images and css,js folder, what's this storage in Laravel 5? How do I store files in new version using asset() to access them?

Maytham Fahmi
  • 31,138
  • 14
  • 118
  • 137
  • 1
    There's a `public` folder in Laravel 5, that hasn't changed between the two versions. – Tim Lewis Nov 10 '15 at 17:25
  • 1
    Laravel 5 has also public folder, but it has also a place called storage and resources. Resouces is for your templates etc files, Storage is writable folder for logs etc. and public is for all public content. If you have important content you want only share with you members you can save those on Storage and Show only to specific users or members. http://laravel.com/docs/master/structure#the-root-directory – Maytham Fahmi Nov 10 '15 at 17:29
  • If that does not cover what you asked for, let us know – Maytham Fahmi Nov 10 '15 at 17:33
  • @maytham-ɯɐɥıλɐɯ thanks sir, i'm understand me –  Nov 10 '15 at 17:39
  • @mahdipishguy you are welcome dude. – Maytham Fahmi Nov 10 '15 at 17:41

1 Answers1

2

There are 3 folders which are relevant to your questions.

They are place in The Root Directory.

Regarding to Laravel The Root Directory documentation:

  • The public directory contains the front controller and your assets (images, JavaScript, CSS, etc.).

  • The resources directory contains your views, raw assets (LESS, SASS, CoffeeScript), and localization files.

  • The storage directory contains compiled Blade templates, file based sessions, file caches, and other files generated by the framework. This folder is segregated into app, framework, and logs directories. The app directory may be used to store any files utilized by your application. The framework directory is used to store framework generated files and caches. Finally, the logs directory contains your application's log files.

It is possible to create a content folder in Storage folder and share it only for members (means no available for public access), if that the case follow example link below.

To define path in your code, for public path use public_path the same for storage storage_path regarding to Laravel Paths documentation.

Finally here you find the example of storage_path usage and how you protect you files and folders from public access.

How to protect image from public view in Laravel 5?

Community
  • 1
  • 1
Maytham Fahmi
  • 31,138
  • 14
  • 118
  • 137