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 :
- Laravel 9 QR Code Generator Basic To Advanced Tutorial Example
- How To Convert HTML To Image/PDF Using Snappy In Laravel 9
- Facade Laravel
- How To Get Last Record From The Laravel Collection Using last() Collection Method Possible all Example
- toArray() Method | Laravel Collection Example
- Laravel 6 - QR Code Generator Example
- Import Export Database in JSON Format Laravel
- How to create Excel file in Laravel 6
- Laravel broadcasting with redis and socket.io
- Call to undefined function Gregwar\Captcha\imagecreatetruecolor()