Laravel 10 Create Controller Example

  • 23-02-2023
  • 488
  • Laravel 10
  • Haresh Chauhan

In this post we will see how to create controller in laravel 10, In laravel 10 creating controller is a little bit different from the other version, Here in laravel 10 make a controller with the chosen parameter in the command. I will tell you how to make a controller in laravel 10 and its command to press.

Laravel 10 provided more facilities for making controllers using the command, I will tell you how to make it and also we will make it in laravel 10 controller with different parameters choose in command.

Step 1. Install Laravel 10

If you already installed laravel 10, skip this step. This step is for the beginner who doesn't install 10 laravel projects. use the below command and install laravel 10.

composer create-project laravel/laravel example-app

Make Controller

First, we will just add the make: controller command with the artisan in the command prompt.

php artisan make:controller

image

Now we will add the controller name in the parameter, here in this example I am making UserController. so I will put UserController.

UserController

Admin/UserController // WITH THE PATH CREATE

image

Now they will ask for the add mode in the controller, so we will add the User mode name in the parameter in the command so that it will predefine in the controller User model with the namespace.

User // Model Name

image

So this way you can create a controller in laravel 10 very easy way. I hope you learn something new from the post.


We always thanks to you for reading our blogs.


dharmesh-image

Dharmesh Chauhan

(Swapinfoway Founder)

Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us

haresh-image

Haresh Chauhan

(Co-Founder)


We Are Also Recommending You :