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
What is helper function in laravel?
How to get current route name?
Explain how to register a middleware in laravel?
What are service providers?
Where will you define laravel's facades?
Can you update homestead?
Tell me what is database migration? And how to use it to add insert initial data to database?
What is csrf protection?
What are the default ports that are forwarded to your homestead environment?
What route model binding?
How do laravel facades work?
How to access session data?
What is an api route?
What is use in laravel?
What is laravel api?