How can I pass a static class to an object through Injection Dependency?
For example, Carbon uses static methods:
$tomorrow = Carbon::now()->addDay();
I have services that depend on Carbon, and currently I use the library in dependencies without inserting them. But this increases the connection, and I would like to pass it through DI instead.
I have the following controller:
$container['App\Controllers\GroupController'] = function($ci) {
return new App\Controllers\GroupController(
$ci->Logger,
$ci->GroupService,
$ci->JWT
);
};
How to pass Carbon into this?
source
share