What is Laravel? (MVC)
A framework that gives you everything — routing, database, templates, auth — in an elegant, organised structure called MVC.
What you will learn
- Explain what a framework is
- Understand the MVC pattern
- See why Laravel speeds you up
A framework gives you structure
Laravel is the most popular PHP framework — a ready-made structure and toolkit so you do not build everything from scratch. The raw PHP you learned (forms, sessions, PDO, OOP) is all here, but organised and far easier.
MVC — how Laravel organises code
| Part | Job | Example |
|---|---|---|
| Model | The data (talks to the database) | User model |
| View | The HTML the user sees | A Blade template |
| Controller | The logic connecting them | UserController |
The flow: a request hits a route → the route calls a controller → the controller uses a model to get data → it passes data to a view → the view’s HTML is sent back.
Here is that same request-to-response journey spelled out step by step, so you can see how the three MVC parts hand work to each other:
- The browser sends a request (for example, the user visits
/products). - Laravel looks in your routes file and finds the route that matches that URL.
- The route hands control to a controller method — the place your logic lives.
- The controller asks a model for the data it needs (for example, all products from the database).
- The controller passes that data into a view (a Blade template).
- The view fills the data into HTML, and Laravel sends that finished HTML page back to the browser.
Tip: Everything you did manually in raw PHP, Laravel does elegantly: routing, database queries (Eloquent), templates (Blade), forms, validation, login. You will appreciate every shortcut because you know what is underneath.
Q. In MVC, which part handles the data and talks to the database?
✍️ Practice
- Draw the MVC request flow for “show a list of products”.
- Match Model/View/Controller to what each does.
🏠 Homework
- Explain MVC in your own words with a real-world analogy.