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 blade template?
How do I use eloquent to get a list of comments with one author each avoiding n+1 queries?
List the requirements to install valet?
Tell us have you used lumen before?
How to register a middlewares in laravel controller?
Explain me what directories that need to be writable laravel installation?
How to Redirecting to Controller Actions in Laravel ?
What is use of model in laravel?
How to generate application key in laravel? Why it is neccessary?
How to configure route cache in laravel?
What are enhancement features in laravel 5.8?
What is mass assignable in laravel?