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 the best way to learn laravel?
What is x-csrf-token?
What is laravel vue?
How to Redirecting to Controller Actions in Laravel ?
State the difference between codeigniter and laravel.
What is laravel auth guard?
How to get data between two dates with query in laravel?
How to create Creating a Controller ?
How to use joins in laravel?
By default valet serve your app which tld?
How to use stored procedures in laravel?
What is orm laravel use?