Files
monica/app/Jobs/SendNewUserAlert.php
T

43 lines
900 B
PHP

<?php
namespace App\Jobs;
use App\Models\User\User;
use Illuminate\Bus\Queueable;
use App\Notifications\NewUserAlert;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Notification;
class SendNewUserAlert implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels;
protected $user;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$email = config('monica.email_new_user_notification');
if (! empty($email)) {
Notification::route('mail', $email)
->notify(new NewUserAlert($this->user));
}
}
}