From f54b596128e41a12feb84a17e8a7c015134dfb16 Mon Sep 17 00:00:00 2001 From: AVMG20 Date: Sat, 26 Jun 2021 16:57:03 +0200 Subject: [PATCH] notification additions --- app/Console/Commands/ChargeCreditsCommand.php | 2 +- app/Notifications/ServersSuspendedNotification.php | 13 ++++++++++--- routes/web.php | 5 ----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/Console/Commands/ChargeCreditsCommand.php b/app/Console/Commands/ChargeCreditsCommand.php index e3bd5e7d..35bfad0a 100644 --- a/app/Console/Commands/ChargeCreditsCommand.php +++ b/app/Console/Commands/ChargeCreditsCommand.php @@ -64,7 +64,7 @@ class ChargeCreditsCommand extends Command try { #suspend server $this->line("{$server->name} from user: {$user->name} has been suspended!"); - #$server->suspend(); + $server->suspend(); #add user to notify list if (!in_array($user, $this->usersToNotify)) { diff --git a/app/Notifications/ServersSuspendedNotification.php b/app/Notifications/ServersSuspendedNotification.php index 71d6db07..7a399cf2 100644 --- a/app/Notifications/ServersSuspendedNotification.php +++ b/app/Notifications/ServersSuspendedNotification.php @@ -2,6 +2,7 @@ namespace App\Notifications; +use App\Models\Configuration; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; @@ -29,7 +30,7 @@ class ServersSuspendedNotification extends Notification implements ShouldQueue */ public function via($notifiable) { - return ['mail']; + return ['mail' , 'database']; } /** @@ -43,7 +44,7 @@ class ServersSuspendedNotification extends Notification implements ShouldQueue return (new MailMessage) ->subject('Your servers have been suspended!') ->greeting('Your servers have been suspended!') - ->line("To unsuspend your server/s you need to purchase more credits.") + ->line("To automatically re-enable your server/s, you need to purchase more credits.") ->action('Purchase credits', route('store.index')) ->line('If you have any questions please let us know.'); } @@ -57,7 +58,13 @@ class ServersSuspendedNotification extends Notification implements ShouldQueue public function toArray($notifiable) { return [ - // + 'title' => "Servers suspended!", + 'content' => " +
Your servers have been suspended!
+

To automatically re-enable your server/s, you need to purchase more credits.

+

If you have any questions please let us know.

+

Regards,
" . config('app.name', 'Laravel') . "

+ ", ]; } } diff --git a/routes/web.php b/routes/web.php index e0184fab..ecf59ce2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -114,11 +114,6 @@ Route::middleware('auth')->group(function () { Route::resource('api', ApplicationApiController::class)->parameters([ 'api' => 'applicationApi', ]); - - #Testing route to preview new ConfirmedPaymentNotification email - Route::get('test' , function(Request $request){ - return (new \App\Notifications\ConfirmPaymentNotification(\App\Models\Payment::factory()->create()))->toMail($request->user()); - }); }); Route::get('/home', [HomeController::class, 'index'])->name('home');