Welcome to CodeCrew Infotech

shape shape
Shape Shape Shape Shape

MVC Framework

Laravel is a free open-source web PHP framework and it is based on MVC( Model, View, Controller) architecture.

A framework provides structure and starting point for creating a new application. and it provides a developer experience with powerful features.

It's always used for complex web applications with secure web apps and one of the main things is it is Full Stack Framework.

How to create your first Laravel project:

composer create-project laravel/laravel project-name

To understand Laravel more, we need to learn about MVC (Model-View-Controller) structure.

Overview of MVC: The application is primarily divided into three parts by the MVC-based framework:

Model:-  It interacts with the database.

View:-  User Interface. It contains everything which a user can see on the screen.

Controller:-  It helps to connect Model and View and contains all the business logic. It is also known as the “Heart of the application in MVC”.



Model:- Model is responsible for operating the database. Like fetching data from the database as well all CRUD(Insert, update, delete) operations will be performed using model

View:- User/client interacts using view which means view which is showing in front of the client/users/views. The user is presented with an interface that shows the output. It is important to note that a view will not display anything. A controller or model indicates what should be displayed to the user to the view. Additionally, it informs the controller when a request is made by the user. 

Controller:- Controller control Model and View, for example. The user wants to fill out a registration form, then they will fill in data via View. Then, they click on submit, and the Controller will actively validate his data, accept data from the user form, and passed to the Model. And Model stores it in the database and returns success to the Controller, and Controller will send a success message to the View. And finally, the user read his success message. that means its provides a mediator between view and model.


Why MVC?

It is mostly used to separate application code into data, control logic, and user interfaces. Having easy code maintenance can benefit the developer and help the development process run much more smoothly.


Advantages of Using MVC framework:

1. Faster development process.

2. Changes in any part won’t affect any other part of the code because all three are different.

3. Simple to perform any Modification or changes in any part.

4. Managing large-scale projects involving web applications.

5. Support for asynchronous techniques

6. Multiple views

7. SEO-friendly platform