exception Illuminate\Container\EntryNotFoundException when try using command
ahmed-ouredu opened this issue · 4 comments
ahmed-ouredu commented
I'm getting this error
Illuminate\Container\EntryNotFoundException
<?php
namespace App\Console\Commands;
use App\Jobs\PingJob;
use Illuminate\Console\Command;
use App\Events\SomeEvent;
class PingJobCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ping:job';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
* @throws \Throwable
*/
public function handle()
{
SomeEvent::publish(["name"=>"some name"]);
}
}
masterjus commented
Which one entry was not found?
ahmed-ouredu commented
I changed
Container::getInstance()
->get(Publisher::class)
->publish($event);
to
Container::getInstance()
->make(Publisher::class)
->publish($event);
and it's working fine
masterjus commented
Ok, Please make a PR with this change
masterjus commented
Merged