How to start learning laravel 9?

Lot of beginners are always confuse when they start learning something new. If you are learning laravel for the first time you wonder as a beginner where to start?

What things should I learn first? In this tutorial I will explain step by step on what to learn first in laravel and then getting your skills to advance level.

First thing you need to learn is how framework flow works. What I mean to say is when a user type in a web address how does request flows from browser to laravel framework.

Once you understand this flow you will understand the starting point. We know that laravel is a MVC framework therefore we would have to understand the MVC concept first.

Laravel request flow diagram

MVC stands for Model, View and Controller where model referes to your database interactions, view refers to your html code and controller refers to a place where you can fetch data from the model and pass this data in the form of array to your view.

Let's look at the following diagram:

In above diagram an actor is a person who access the website in the browser. When user hit the web address in the browser first it creates a request.

This request then goes to given domain name where your laravel project is running on a remote server. Laravel look at the incoming request and finds the appropriate route that points to specific controller function,

Let say that a user types a url to web browser like chrome. Following diagram shows how this request is travelling under the hood using laravel framework.

In laravel a route is basically url in the browser that points to specific controller method. When user hit specific route laravel knows how to forward this request to appropriate controller.

Once your request hits the controller method. You need to decide on what to do. Here are some of the basic things that you can do in the controller:

  • you can pass static variables declared in controller to your view
  • you can pass dynamic variables to your view

For now, let say that you want to show list of blogs on your webpage. Your model in laravel points to specific table in the database and to be more specific a single record in the database.

Now, your controller will call the model and run some queries on your model to fetch the data from the model. Once we have this data we can pass this data to view where we can use this data and create a dynamic html page.

Controller then sends this parsed html as a response to user and user can see laravel webpage in the browser I hope you are following me till here so far.

Next steps

Now that you have a little bit of understanding about MVC and you know how request/response works in laravel our next task is to create a sample webpage in laravel 9.

In our next tutorial we will learn following things:

  • how to create a route that points to laravel controller method
  • how to create a new controller class with method
  • how to create a view file

Our task is to create a simple static webpage without any model interaction at this point.

What did we learn in this tutorial?

In this tutorial we learned about MVC concept. We also learned about laravel route, controller, view and model however we did not learn about this concept in depth which we will learn in upcoming tutorials.

I would suggest to follow my tutorials in order to get better understanding. Hope this helps thanks.