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
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
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
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 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 Chauhan
(Co-Founder)We Are Also Recommending You :
- Import Export Database in JSON Format Laravel
- Laravel pwa Integration Tutorial
- Laravel 9 Ajax Image Upload With Preview Tutorial
- Laravel Carbon diffForHumans Arguments Passing
- Laravel 10 Create Custom Helper Function Example
- [Fixed] 429: Too Many Attempts When Call API In Laravel 8 9
- How To Clone Laravel
- Trying to access array offset on value of type int
- Median() Method | How It is Different From avg() Method In Laravel Collection
- Laravel 6 call function undefined str_slug() - fix