Laravel is an MVC framework. MVC stands for Model-View-Controller.
A model is a representation of your data. The Models represent the data and business logic for your application. It’s where you define the structure of your data and how it interacts with the rest of your application. For example, in our application, we will record employee data. Therefore, we are going to have a model of an employee.
Each employee consists of:
- Name of the employee
- Department of the employee
- The joining date of the employee
- Salary of the employee
We’ll have a model representing and storing this data in the database.
A view is the presentation layer. For example, we’ll need a form so that use can enter his data to create a new registration. This form code is a view.In Laravel, we use a special templating language called Blade.
Blade files are names in this format: “[name].blade.php”
resources-views-[name].blade.php
Controller: The controller acts as a bridge between the Model and View. It processes user inputs, updates the model, generates the appropriate view.Controllers are how you control things. Hence the name. For example, you can to show the list of registered users.
The controller will use the purchase model to fetch alist of purchases. Then it will pass this data to the view, so it ca show it to the user.
app-http-controllers-nameOfController
The post What is MVC? appeared first on PHPGurukul.
Source: Read MoreÂ