In this tutorial, we will see all the important folders details which use during creating a project in laravel.
App folder
App is an application folder that has the entire source code of the project.
App folder contains console, exceptions, http, model, providers.
1) Console folder
Artisan commands are included in the kernel.php file inside the console folder which is necessary for laravel.
2) Exceptions folder
Exceptions folder contains all the error handling method inside the handle.php file.
3) Http folder
The folder has two subfolders for controller and middleware.
-
Controllers
Controllers folder contains controllers file in which we can write all the request handling logic related to users, like- showing, creating, updating, deleting operations.
- Middleware
In the middleware folder, we can put all the middleware files that work after the request sent by the user and before loading your webpage.
For example, if you send a request to open any web page but if any restriction is written for your computer IP address in the middleware file, then you could not visit this web page.
kernel.php
In kernel.php file, which is inside the middleware folder is used to tell laravel about your middleware file because if you do not declare about your middleware file in the kernel.php then your middleware file not run.
Model folder
The model folder consists of model files. Each table in the database has a corresponding "model" which allow to interact with the table.
Public folder
The public folder consists of CSS, JS, image folder.
- CSS folder - It consists of all CSS files.
- JS folder - It consists of all JS files.
- Image folder - It consists of all images.
Resource folder
The resource folder has a 'view' subfolder which is used to keep all the HTML files inside it.
Routes folder
Routes folder have a file which is web.php used to bind URL to controller action.
.ENV file
It is a configuration file in which we can do all type of third party configuration task like, database configuration, all type of API configuration etc.