This commit is contained in:
Saeed Vaziry
2023-07-02 12:47:50 +02:00
commit 5c72f12490
825 changed files with 41659 additions and 0 deletions

View File

@ -0,0 +1,44 @@
<?php
namespace App\Notifications;
use App\Contracts\Notification;
use App\Models\Server;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
class FailedToDeleteServerFromProvider implements Notification
{
use Queueable;
protected Server $server;
public function __construct(Server $server)
{
$this->server = $server;
}
public function subject(): string
{
return __('Failed to delete the server from the provider!');
}
public function message(bool $mail = false): mixed
{
if ($mail) {
return $this->mail();
}
return __("We couldn't delete [:server] \nfrom :provider \nPlease check your provider and delete it manually", [
'server' => $this->server->name,
'provider' => $this->server->provider,
]);
}
public function mail(): MailMessage
{
return (new MailMessage)
->line("We couldn't delete [".$this->server->name.'] from '.$this->server->provider)
->line('Please check your provider and delete it manually');
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Notifications;
use App\Contracts\Notification;
use App\Models\Ssl;
class SSLExpirationAlert implements Notification
{
protected Ssl $ssl;
public function __construct(Ssl $ssl)
{
$this->ssl = $ssl;
}
public function subject(): string
{
return __('SSL expiring soon!');
}
public function message(bool $mail = false): string
{
return $this->ssl->site->domain."'s ".__('SSL is expiring on').' '.$this->ssl->expires_at->format('Y-m-d');
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Notifications;
use App\Contracts\Notification;
use App\Models\Server;
use Illuminate\Notifications\Messages\MailMessage;
class ServerDisconnected implements Notification
{
protected Server $server;
public function __construct(Server $server)
{
$this->server = $server;
}
public function subject(): string
{
return __('Server disconnected!');
}
public function message(bool $mail = false): mixed
{
if ($mail) {
return $this->mail();
}
return __("We've disconnected from your server [:server]", [
'server' => $this->server->name,
]);
}
public function mail(): MailMessage
{
return (new MailMessage)
->line("We've disconnected from your server [".$this->server->name.'].')
->line('Please check your sever is online and make sure that has our public keys in it');
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Notifications;
use App\Contracts\Notification;
use App\Models\Server;
use Illuminate\Notifications\Messages\MailMessage;
class ServerInstallationFailed implements Notification
{
protected Server $server;
public function __construct(Server $server)
{
$this->server = $server;
}
public function subject(): string
{
return __('Server installation failed!');
}
public function message(bool $mail = false): mixed
{
if ($mail) {
return $this->mail();
}
return __("Installation failed for server [:server] \nCheck your server's logs \n:logs", [
'server' => $this->server->name,
'logs' => url('/servers/'.$this->server->id.'/logs'),
]);
}
private function mail(): MailMessage
{
return (new MailMessage)
->line('Your server ['.$this->server->name.'] installation has been failed.')
->line('Check your server logs')
->action('View Logs', url('/servers/'.$this->server->id.'/logs'));
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Notifications;
use App\Contracts\Notification;
use App\Models\Server;
use Illuminate\Notifications\Messages\MailMessage;
class ServerInstallationStarted implements Notification
{
protected Server $server;
public function __construct(Server $server)
{
$this->server = $server;
}
public function subject(): string
{
return __('Server installation started!');
}
public function message(bool $mail = false): mixed
{
if ($mail) {
return $this->mail();
}
return __("Installation started for server [:server]\nThis may take several minutes depending on many things like your server's internet speed.\nAs soon as it finishes, We will notify you through this channel.\nYou can check the progress live on your dashboard.\n:progress", [
'server' => $this->server->name,
'progress' => url('/servers/'.$this->server->id),
]);
}
public function mail(): MailMessage
{
return (new MailMessage)
->line('Your server\'s ['.$this->server->name.'] installation has been started.')
->line("This may take several minutes depending on many things like your server's internet speed.")
->line('As soon as it finishes, We will notify you through this channel.')
->line('You can check the progress live on your dashboard.')
->action('Installation Progress', url('/servers/'.$this->server->id));
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Notifications;
use App\Contracts\Notification;
use App\Models\Server;
use Illuminate\Notifications\Messages\MailMessage;
class ServerInstallationSucceed implements Notification
{
protected Server $server;
public function __construct(Server $server)
{
$this->server = $server;
}
public function subject(): string
{
return __('Server installation succeed!');
}
public function message(bool $mail = false): mixed
{
$this->server->refresh();
if ($mail) {
return $this->mail();
}
return __("Installation succeed for server [:server] \nServer IP: :ip \nUser: :user\nPassword: :password\n:link", [
'server' => $this->server->name,
'ip' => $this->server->ip,
'user' => $this->server->authentication['user'],
'password' => $this->server->authentication['pass'],
'link' => url('/servers/'.$this->server->id),
]);
}
public function mail(): MailMessage
{
$this->server->refresh();
return (new MailMessage)
->line('Your server ['.$this->server->name.'] has been installed successfully.')
->line('Server IP: '.$this->server->ip)
->line('User: '.$this->server->authentication['user'])
->line('Password: '.$this->server->authentication['pass'])
->action('Manage Your Server', url('/login'));
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class SourceControlDisconnected extends Notification implements ShouldQueue
{
use Queueable;
protected string $sourceControl;
public function __construct(string $sourceControl)
{
$this->sourceControl = $sourceControl;
}
public function via(): array
{
return ['mail'];
}
public function toMail(): MailMessage
{
return (new MailMessage)
->subject('Lost connection to your '.$this->sourceControl)
->line("We've lost connection to your $this->sourceControl account.")
->line("We'll not able to do any deployments until you reconnect.")
->line("To reconnect your $this->sourceControl account please click on the bellow button.")
->action('Reconnect', url('/source-controls'));
}
public function toArray(): array
{
return [
//
];
}
}