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 is a pull() ?
What is laravel passport?
what is meant by CSRF Protection in Laravel ?
How to register a middleware in laravel 5?
In which folder robot.txt is placed?
What do you understand by unit testing?
What is name of first file that loaded in laravel?
Does laravel use bootstrap?
How to enable or disable maintaince mode in laravel.
How to make a custom validation rule in laravel?
What is a facade?
Explain reverse routing in laravel.