Few Words about Laravel Model, View, Controller

As a beginner you may want to get a basic idea about how MVC or Model-View-Controller framework works.
Primarily in the Model part we keep our application or business logic and through this logic we access data working on it further – adding, editing or deleting.
View is the part where presentation layer lies. It presents a view to the users. I think I need not elaborate. You know what I mean.
Now the question is: what is the function of controller? Actually controller is the transporter. It acts as a bridge between model and view. It manages the communication between model and view. When you send a form on a web page, what happens? In the background, the controller actually accepts the inputs and converts it into commands for model. Once the inputs have been processed in model it again calls the controller to render it to view.

Some programmers prefer to place application logic in a more secured place using interfaces. That’s a good practice. It’s always good that the transporter should not know what he carries. His job is delivering the product. Controller accepts and delivers. Please keep this concept in mind.
This layer division closely resembles another design pattern. Presentation–abstraction–control (PAC) is a software architectural pattern which is somewhat similar to model–view–controller (MVC). The abstraction component retrieves and processes data. Presentation component renders that data and the control component controls the flow of communication between two other components.
The advantage of Laravel is: it adds more functionality so that you can use this design pattern in a more robust way.
Let’s try to understand how it works.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s