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 best backend framework?
Tell me what is database migration? And how to use it to add insert initial data to database?
How to generate a controller with resources in laravel?
How do I use sub-domain routing?
What is meant by Laravel - Ajax ?
What is report method?
What is a Encryption Process ?
What is meant by Authorization Mechanism in Laravel ?
What are Global Middleware and Route Middleware ?
By default valet serve your app which tld? On how to configure it to use another domain?
What is the make method?
Tell me how to enable maintenance mode in laravel 5?