How to create Creating a Controller ?
Answers were Sorted based on User's Feedback
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 |
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 |
What are bundles, reverse routing and the ioc container?
How do I send 5 emails and a text message efficiently to newly registered users?
Define composer.
What is eloquent?
How do I set up the eloquent relationships between the aforementioned comments and authors, including creating the schema design?
What is the difference between forget() and the pull() method ?
How to assign a variable value for all view file?
What do you call a single quote?
What is a Laravel - Encryption ?
What is namespace laravel?
How to generate it on homestead?
What does guid stand for?