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
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)
We Are Also Recommending You :
- Queue Laravel Command Tutorial Example
- Laravel 10 Arr::pluck() Helper Function Use Example
- Filtering data excel export in laravel example
- Laravel 9 Sanctum API Authentication Tutorial
- Laravel 9 Telescope Integration Tutorial
- How To Generate A Sitemap In Laravel 6/7/8/9
- Arr::add() | Laravel Helper Function
- Arr::crossJoin() | Laravel Helper Function
- How to send mail example in Laravel 6
- Laravel Logs Viewer Integration