What is the concept of controller in Laravel

0 votes
what the the useful work of controller in MVC??
Mar 18, 2020 in Laravel by kartik
• 37,520 points
1,260 views

1 answer to this question.

0 votes

Hii,

In the MVC framework, the letter ‘C’ stands for Controller. It acts as a directing traffic between Views and Models

In order to create controller

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

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

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.

You will see that some basic coding has already been done for you and you can add your custom coding. The created controller can be called from routes.php by the following syntax.

Syntax

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

Thank you!!

answered Mar 18, 2020 by Niroj
• 82,840 points

Related Questions In Laravel

0 votes
1 answer

What is yield in Laravel and what is the use of yield?

Hii kartik, In Laravel, @yield is principally used to define ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
29,037 views
0 votes
1 answer

What is the significant difference between insert() and insertGetId() function in Laravel?

Hello, Insert(): This function is simply used to ...READ MORE

answered Mar 17, 2020 in Laravel by Niroj
• 82,840 points
2,933 views
0 votes
1 answer

Explain the concept of encryption and decryption in Laravel?

It is a process of transforming any ...READ MORE

answered Mar 17, 2020 in Laravel by Niroj
• 82,840 points
1,330 views
0 votes
1 answer

What is the difference between Facades and Dependency Injection in Laravel?

Hello, The main differnece between them is explained ...READ MORE

answered Mar 26, 2020 in Laravel by Niroj
• 82,840 points
3,327 views
0 votes
1 answer

What is Laravel framework? Why one should use Laravel?

Laravel is a PHP web-framework; it utilized ...READ MORE

answered Mar 17, 2020 in Laravel by Niroj
• 82,840 points
1,682 views
0 votes
1 answer

How to download and install Lavavel framework?

Hey @kartik, First you must have xampp install ...READ MORE

answered Mar 17, 2020 in Laravel by Niroj
• 82,840 points
1,442 views
0 votes
1 answer

How can we get started with Laravel through Xampp?

Hii, First you need to start Apache and ...READ MORE

answered Mar 17, 2020 in Laravel by Niroj
• 82,840 points
1,017 views
0 votes
1 answer

What are the important directories used in a common Laravel application

Hey @Kartik. Directories used in a common Laravel ...READ MORE

answered Mar 17, 2020 in Laravel by Niroj
• 82,840 points
2,418 views
0 votes
1 answer

What is the use of Facade Pattern in Laravel?

Hey kartik, Facades provide a static interface to classes that are ...READ MORE

answered Mar 19, 2020 in Laravel by Niroj
• 82,840 points
1,616 views
0 votes
1 answer

What is the use of the Eloquent cursor() method in Laravel?

Hello, The cursor method allows us to iterate ...READ MORE

answered Mar 20, 2020 in Laravel by Niroj
• 82,840 points
10,765 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP