Laravel is a MVC framework. MVC means Model view Controller.
Models are the real world entities. In other words, models are the real world entities conventions in the form of data at website. For example, for an online shopping website Products (items), Offers and User are the models. These are associated with database tables and handles the relations and operations. A product may have some offers and discounts. Models are more than stored data. Product model must have some constrains (number of items, cost, conditional offers). A model fulfills all expects of an entity.
View refers the content (HTML pages) which is served to the user/ visitor. For example, when you visit an online shopping website, you are served with lists of items (products), offers, shopping cart etc. All this content is makeup data (HTML) for displaying in the browser. This makeup is known as view in MVC.
Controller is the bridge between Model and View. It handles the request from the user with logic. For an online shopping shopping site, searching and filtering products, updating the cart, handling user authentication and checkout the payment are the some controllers. In MVC, HTML content and database are not directly accessible for outer world. These are serve via controllers.
also see Django vs Laravel vs Rails
If you have installed laravel then you can easily know the purpose of each file by reading comments inside those file.
|app||It contains the Models and Controllers of the application. It also contains all of the logic for performing any operation. Models are placed directly inside this folder.|
|bootsrap||This folder contains the basic setting for starting the application|
|config||This folder contains all configuration settings of the application like database connection, including core classes, email settings, etc.|
|database||This folder contains the code for database transactions like creating table, modifying columns, adding default rows in database, etc.|
|public||This folder is can be seen by outer world. This is the directory that is to be pointed to web server. All static assets (like css, js, less, etc.) are placed here. The index.php file in this folder calls the bootstrap folder files and other core files and starts the application. This index.php file receives all of the requests and after complex process responses the content to the visitor. In other words, this is the file which transactions with browser.|
|resources||This folder contains the resources of the application like views, raw assets, language for localization, etc.|
|storage||This folder stores the local data like sessions, caches, compiled views files, etc.|
|tests||This folder contains all tests of application|
|vendor||This folder contains all third party files (dependencies and additional prepackages for plugins) and code files of the laravel frameworks.|
Other important folders and files are:
- app/ Http: This folder contains controllers and routes. Routes are defined in routes.php and controllers are defined in Controllers folder. This folder contains two more folders. Requests folder handles the form requests and Middleware folder contains middlewares.
- app/ Exception: This folder contains the exception classes
- app/ Services:This folder is used for defining new services. By default it contains registrar service (used for registering new users).
- app/ Providers: This folder registers and binds the services.
- resources/views: This folder contains the views files.
- .env: This is a hidden file in root folder of the application. This file contains the private data like database username and password, email configuration data etc.
More Tutorials on laravel in this series: