Explain Constructor Injection ?



Explain Constructor Injection ?..

Answer / rachana devi

The Laravel service container is used to resolve all Laravel controllers.
As a result, you are able to type-hint any dependencies your controller may need in its constructor.
The dependencies will automatically be resolved and injected into the controller instance.

Example :

class MyClass
{
public $foo = 'bar';
}
Route::get('/myclass','ImplicitController@index');


we have to Add the following code to app/Http/routes.php file. "app/Http/routes.php".

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

Do you know what developed the laravel?

0 Answers  


How can we get the user's ip address in laravel?

0 Answers  


What is mvc framework laravel?

0 Answers  


Tell me what is laravel eloquent?

0 Answers  


What is bootstrap software development?

0 Answers  






What is route in laravel?

0 Answers  


List out the plateforms laravel homestead supports?

0 Answers  


How to generate & update application key in laravel 5?

0 Answers  


What is automatic injection in laravel?

0 Answers  


What is dependency injection in laravel?

0 Answers  


How to use ajax in any form submission?

0 Answers  


Is laravel an mvc framework?

0 Answers  


Categories