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 |
Which file is used to create a connection with the database?
What is orm framework?
What are service providers in laravel?
What is dd() function in laravel?
Why laravel over other php frameworks?
Tell me what is system requirement for installation of laravel 5.2 (latest version)?
How to do environment configuration in laravel.
How can we handle Error Handling in Laravel ?
How to remove a complied class file?
Explain laravel query builder?
What are the benefits of facades?
How to stop valet?