Answer the question
In order to leave comments, you need to log in
Events queued through database, how to organize them correctly?
I added and generated an event and a listener:
protected $listen = [
'App\Events\TestEvent' => [
'App\Listeners\TestEventListener',
],
];
event(new TestEvent($data));
namespace App\Listeners;
use App\Events\TestEvent;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class TestEventListener implements ShouldQueue
{
public function __construct()
{
//
}
public function handle(TestEvent $event)
{
//
}
}
Answer the question
In order to leave comments, you need to log in
It is necessary to run php artisan queue:work
that the queues would be executed
. Here is the dock.
public function handle(Mailer $mailer)
{
$mailer->send('email.welcome', ['data'=>'data'], function ($message) {
$message->from('[email protected]', 'Christian Nwmaba');
$message->to('[email protected]');
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question