How to Create Controller in Laravel 6 using Command ?
Teams applying “How to Create Controller in Laravel 6 using Command ?” in a production project can use the linked methodology to record implementation, review and debugging time, then compare that effort with tests and shipped functionality instead of treating activity as performance by itself.
Before copying the example into a live application, confirm version-specific behaviour with the official Laravel website and test it against the project’s actual database and runtime.
Hi Guys,
In this tutorial, I will let you know laravel 6 create controller using command. we will learn How to Create Controller in Laravel 6 using Command. i will give you more examples of artisan command to create controller in laravel 6.
You can see list of examples of artisan command to create controller in laravel 6.
Example 1:
php artisan make:controller PostController ->It will create simple controller class name
->It will also create fille following path.
1.controller:-
app/Http/Controllers/PostController.php
Example 2.
php artisan make:controller PostController --resource->It will create controller name with file.
->It will also create following methods as resource controller as PostController:
index,create,store,show,edit,update,destroy
->It Will passing the argument as --resource.
->It will also create fille following path.
1.controller:-
app/Http/Controllers/PostController.php
Example 3.
php artisan make:controller PostController --resource --model=Post ->It will create controller name and model with file.
->It will also create following methods as resource controller as PostController:
index,create,store,show,edit,update,destroy
->It Will passing the argument as --resource and --model.
->It will also create fille following path.
1.controller:-
app/Http/Controllers/PostController.php
2.model:-
app/Post.php
Example 4.
php artisan make:controller PostController --api->It will create api controller name with file.
->It will also create following methods as resource controller as PostController:
index,create,store,show,edit,update,destroy
->It Will passing the argument as --api.
->It will also create fille following path.
1.controller:-
app/Http/Controllers/PostController.php
Example 5.
php artisan make:controller PostController --invokable ->It will create api controller name with file.
->It will also create following methods as resource controller as PostController:
__invoke
->It Will passing the argument as --invokable.
->It will also create fille following path.
1.controller:-
app/Http/Controllers/PostController.php
Example 6.
php artisan make:controller PostController --parent=Post
->It will create controller name and model with file.
->It will also create following methods as resource controller as PostController:
index,create,store,show,edit,update,destroy
->It Will passing the argument as --parent.
->It will also create fille following path.
1.controller:-
app/Http/Controllers/PostController.php
2.model:-
app/Post.php
->It will Call method in all require parameter
It will help you......
# Laravel
# Laravel 6
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial