36 lines
677 B
PHP
36 lines
677 B
PHP
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use App\Models\User;
|
|
use App\Notifications\SendApiTokenNotification;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
|
|
class UserMailVerified
|
|
{
|
|
/**
|
|
* Create the event listener.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the event.
|
|
*
|
|
* @param object $event
|
|
* @return void
|
|
*/
|
|
public function handle($event)
|
|
{
|
|
$user = $event->user;
|
|
$token = $user->createToken("api_token")->plainTextToken;
|
|
$notif = new SendApiTokenNotification($token);
|
|
$user->notify($notif);
|
|
}
|
|
}
|