Прохожу курс на ларакаст, повторил всё как в видео, ивент запускается, а вот ллисенер нет. Вот код:
Ивент<?php
namespace App\Events;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class ProjectCreated
{
use Dispatchable, SerializesModels;
public $project;
public function __construct($project)
{
$this->project = $project;
}
}
Лисенер<?php
namespace App\Listeners;
use App\Events\ProjectCreated;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class SendProjectCreatedNotification
{
public function handle(ProjectCreated $event)
{
die('Listener');
}
}
EventServiceProvider<?php
namespace App\Providers;
use App\Events\ProjectCreated;
use App\Listeners\SendProjectCreatedNotification;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
'App\Events\ProjectCreated' => [
'App\Listeners\SendProjectCreatedNotification',
],
];
}
Ивент запускается, лисенер - нет.