I'm using Laravel's own Illuminate \ Auth \ Events \ Registered event to trigger a listener I created to trigger a welcome email.
See what the Listener looks like:
<?php
namespace App\Listeners;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
// instância do evento registered do próprio Laravel
use Illuminate\Auth\Events\Registered;
use Illuminate\Notifications\Notifiable;
use App\Notifications\EnviarEmailBoasVindasNotification;
class EnviarEmailBoasVindas
{
use Notifiable;
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param NovoUsuario $event
* @return void
*/
public function handle(Registered $event)
{
// No "envelope" $event podemos acessar a instância User assim $event->user
$event->user->notify(new EnviarEmailBoasVindasNotification($event));
}
}
My question is for " use Illuminate \ Notifications \ Notifiable " and for the Use Notifiable "instance already within the class. What is the use of these? From what I saw if I removed both, everything will continue to function normally.