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 |
What are contracts?
What are view composers?
How to know laravel version?
How to check composer is installed or not in laravel?
How to configure route cache and clear route cache in laravel?
What is dd() function in laravel?
What is lumen?
What is a laravel model?
How can you display html with blade in laravel?
What is guard in laravel authentication?
How to use joins in laravel?
What is the difference between echo print print_r and var_dump?