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 |
Explain facades in laravel?
What do you mean by eloquent used in laravel 5?
What do you mean by dusk used in laravel 5?
How to share data with views?
How to work with an Error in Laravel ?
List the default ports that are forwarded to your homestead environment?
How do I use eloquent to get a list of comments with one author each avoiding n+1 queries?
What is database migration? And how to use it to add insert initial data to database?
Do you know validations in laravel?
How to serve sites on valet?
What is eager loading in laravel?
How to register a service provider via composer in laravel?