mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
refactoring (#116)
- refactoring architecture - fix incomplete ssh logs - code editor for scripts in the app - remove Jobs and SSHCommands
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\NotificationChannels;
|
||||
|
||||
use App\Contracts\NotificationChannel as NotificationChannelInterface;
|
||||
use App\Models\NotificationChannel;
|
||||
use App\NotificationChannels\NotificationChannel as NotificationChannelInterface;
|
||||
|
||||
abstract class AbstractNotificationChannel implements NotificationChannelInterface
|
||||
{
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\NotificationChannels;
|
||||
|
||||
use App\Contracts\Notification;
|
||||
use App\Models\NotificationChannel;
|
||||
use App\Notifications\NotificationInterface;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class Discord extends AbstractNotificationChannel
|
||||
@ -59,7 +59,7 @@ private function checkConnection(string $subject, string $text): bool
|
||||
return $connect->ok();
|
||||
}
|
||||
|
||||
public function send(object $notifiable, Notification $notification): void
|
||||
public function send(object $notifiable, NotificationInterface $notification): void
|
||||
{
|
||||
/** @var NotificationChannel $notifiable */
|
||||
$this->notificationChannel = $notifiable;
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\NotificationChannels;
|
||||
|
||||
use App\Contracts\Notification;
|
||||
use App\Mail\NotificationMail;
|
||||
use App\Models\NotificationChannel;
|
||||
use App\NotificationChannels\Email\NotificationMail;
|
||||
use App\Notifications\NotificationInterface;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Throwable;
|
||||
|
||||
@ -47,7 +47,7 @@ public function connect(): bool
|
||||
return true;
|
||||
}
|
||||
|
||||
public function send(object $notifiable, Notification $notification): void
|
||||
public function send(object $notifiable, NotificationInterface $notification): void
|
||||
{
|
||||
/** @var NotificationChannel $notifiable */
|
||||
$this->notificationChannel = $notifiable;
|
||||
|
25
app/NotificationChannels/Email/NotificationMail.php
Normal file
25
app/NotificationChannels/Email/NotificationMail.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\NotificationChannels\Email;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class NotificationMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public string $text;
|
||||
|
||||
public function __construct(string $subject, string $text)
|
||||
{
|
||||
$this->subject = $subject;
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
public function build(): self
|
||||
{
|
||||
return $this->html($this->text);
|
||||
}
|
||||
}
|
18
app/NotificationChannels/NotificationChannel.php
Normal file
18
app/NotificationChannels/NotificationChannel.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\NotificationChannels;
|
||||
|
||||
use App\Notifications\NotificationInterface;
|
||||
|
||||
interface NotificationChannel
|
||||
{
|
||||
public function createRules(array $input): array;
|
||||
|
||||
public function createData(array $input): array;
|
||||
|
||||
public function data(): array;
|
||||
|
||||
public function connect(): bool;
|
||||
|
||||
public function send(object $notifiable, NotificationInterface $notification): void;
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\NotificationChannels;
|
||||
|
||||
use App\Contracts\Notification;
|
||||
use App\Models\NotificationChannel;
|
||||
use App\Notifications\NotificationInterface;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class Slack extends AbstractNotificationChannel
|
||||
@ -59,7 +59,7 @@ private function checkConnection(string $subject, string $text): bool
|
||||
return $connect->ok();
|
||||
}
|
||||
|
||||
public function send(object $notifiable, Notification $notification): void
|
||||
public function send(object $notifiable, NotificationInterface $notification): void
|
||||
{
|
||||
/** @var NotificationChannel $notifiable */
|
||||
$this->notificationChannel = $notifiable;
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\NotificationChannels;
|
||||
|
||||
use App\Contracts\Notification;
|
||||
use App\Models\NotificationChannel;
|
||||
use App\Notifications\NotificationInterface;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Throwable;
|
||||
|
||||
@ -46,7 +46,7 @@ public function connect(): bool
|
||||
return true;
|
||||
}
|
||||
|
||||
public function send(object $notifiable, Notification $notification): void
|
||||
public function send(object $notifiable, NotificationInterface $notification): void
|
||||
{
|
||||
/** @var NotificationChannel $notifiable */
|
||||
$this->notificationChannel = $notifiable;
|
||||
|
Reference in New Issue
Block a user