I'm trying to inject a class (a repository) in my app/Console/Kernel
:
public function __construct(LocaleRepository $localeRepository)
{
$this->_localeRepository = $localeRepository;
}
Unfortunately this doesn't work as I receive the following error:
PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [App\Repositories\Interfaces\LocaleRepository] is not instantiable while building [App\Console\Kernel]. in /home/cv/cus/vendor/laravel/framework/src/Illuminate/Container/Container.php:895
I can inject the repository in controllers without any problem. The repository is also registered in the service provider:
public function register()
{
$this->app->bind('App\Repositories\Interfaces\LocaleRepository', 'App\Repositories\Implementations\EloquentLocaleRepository');
}
Is it possible to inject a class in the app/console/Kernel
class?