class Bar
{
...
}
$app->get('/', function(Bar $bar) {
dd($bar);
});
It works when I access the router /
because Laravel can auto resolve the Bar::class
and inject an instance of it .
I want to know since Laravel can do it automatically , then when should we need to create a service provider customly ?
Is there any case to show when to use service provider?
Aucun commentaire:
Enregistrer un commentaire