Create Your First Controller in Laravel

In this lesson we will see how to create your first controller in Laravel. If you do not know how to install Laravel in your computer you can see the this tutorial

This is the directory structure of the Laravel project

So you can create your controller App > Http > Controllers

You can run following command inside the terminal

If you want to create the controller with model you can use the following code

Above artisan command will create the following code in App\Http\Controllers namaspace

Now I will create the show() inside the UserController

Now you can define the route for this controller action in routes>web.php file