how to create controller in laravel through cmd?

Today, We want to share with you how to create controller in laravel.In this post we will show you laravel resource controller example, hear for how to creates controller in laravel through cmd we will give you demo and example for implement.In this post, we will learn about How to creates Controller in Laravel? with an example.

How to creates Controller in Laravel using Artisan Command?

php artisan make:controller DemoController

app/Http/Controllers/DemoController.php


You can easily connect route with controller as like bellow:

routes/web.php

Route::get('demo', 'DemoController@index');

app/Http/Controllers/DemoController.php


You can also creates controller with invokable controller using bellow command:

php artisan make:controller ShowProfile --invokable

app/Http/Controllers/ShowProfile.php


I hope you get an idea about laravel register controller.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment