How to create Creating a Controller ?

Answers were Sorted based on User's Feedback



How to create Creating a Controller ?..

Answer / 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

How to create Creating a Controller ?..

Answer / Pankaj Kumar Dagar

To create a controller in Laravel, you can use the `make:controller` Artisan command followed by the name of your controller. For example: `php artisan make:controller MyController`. This will generate a new PHP file located in the App/Http/Controllers directory.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

What are bundles, reverse routing and the ioc container?

1 Answers  


How do I send 5 emails and a text message efficiently to newly registered users?

1 Answers  


Define composer.

1 Answers  


What is eloquent?

1 Answers  


How do I set up the eloquent relationships between the aforementioned comments and authors, including creating the schema design?

1 Answers  


What is the difference between forget() and the pull() method ?

1 Answers  


How to assign a variable value for all view file?

1 Answers  


What do you call a single quote?

1 Answers  


What is a Laravel - Encryption ?

1 Answers  


What is namespace laravel?

1 Answers  


How to generate it on homestead?

1 Answers  


What does guid stand for?

1 Answers  


Categories