How to create Creating a Controller ?

Answer Posted / sunil kumar

Open the terminal based on the operating system you are using and type the following command to create controller using the Artisan CLI (Command Line Interface).

Syntax : Route::get(‘base URI’,’controller@method’);


Example : php artisan make:controller <controller-name> --plain


It describes above example Replace the <controller-name> with the name of your controller.
This will create a plain constructor as we are passing the argument — plain.
If you don’t want to create a plain constructor, you can simply ignore the argument.
The created constructor can be seen at app/Http/Controllers.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is bearer token?

528


What is a forget() ?

920


What are the Versions Laravel - Understanding Release Process ?

963


What is homestead.yaml?

538


Explain elixir in laravel?

563


What is named route?

520


Do you know what version of laravel do you generally use?

491


What is a Laravel - Contracts ?

985


What is valet used in laravel 5?

550


What is auth? How is it used?

501


Explain how to generate pretty urls in laravel?

533


What is laravel api rate limit?

533


What do you mean by terminable middleware?

521


What does valet park?

503


What is the use of in laravel?

503