mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 10:21:37 +00:00
38 lines
806 B
PHP
38 lines
806 B
PHP
<?php
|
|
|
|
namespace App\NotificationChannels;
|
|
|
|
use App\Mail\NotificationChannelMessage;
|
|
use Illuminate\Support\Facades\Mail;
|
|
|
|
class Email extends AbstractProvider
|
|
{
|
|
public function validationRules(): array
|
|
{
|
|
return [
|
|
'email' => 'required|email',
|
|
];
|
|
}
|
|
|
|
public function data(array $input): array
|
|
{
|
|
return [
|
|
'email' => $input['email'],
|
|
];
|
|
}
|
|
|
|
public function connect(): bool
|
|
{
|
|
$this->notificationChannel->connected = true;
|
|
$this->notificationChannel->save();
|
|
|
|
return true;
|
|
}
|
|
|
|
public function sendMessage(string $subject, mixed $text): void
|
|
{
|
|
$data = $this->notificationChannel->data;
|
|
Mail::to($data['email'])->send(new NotificationChannelMessage($subject, $text));
|
|
}
|
|
}
|