Upgrade to Laravel 9 (#4413)

Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
Matthew Penner 2022-10-14 10:59:20 -06:00 committed by GitHub
parent 95e15d2c8a
commit cbcf62086f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
573 changed files with 4387 additions and 9411 deletions

View file

@ -12,50 +12,25 @@ class AccountCreated extends Notification implements ShouldQueue
{
use Queueable;
/**
* The authentication token to be used for the user to set their
* password for the first time.
*
* @var string|null
*/
public $token;
/**
* The user model for the created user.
*
* @var \Pterodactyl\Models\User
*/
public $user;
/**
* Create a new notification instance.
*/
public function __construct(User $user, string $token = null)
public function __construct(public User $user, public ?string $token = null)
{
$this->token = $token;
$this->user = $user;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
public function via(): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
public function toMail(): MailMessage
{
$message = (new MailMessage())
->greeting('Hello ' . $this->user->name . '!')

View file

@ -1,11 +1,4 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Notifications;
@ -18,10 +11,7 @@ class AddedToServer extends Notification implements ShouldQueue
{
use Queueable;
/**
* @var object
*/
public $server;
public object $server;
/**
* Create a new notification instance.
@ -33,24 +23,16 @@ class AddedToServer extends Notification implements ShouldQueue
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
public function via(): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
public function toMail(): MailMessage
{
return (new MailMessage())
->greeting('Hello ' . $this->server->user . '!')

View file

@ -8,22 +8,16 @@ use Illuminate\Notifications\Messages\MailMessage;
class MailTested extends Notification
{
/**
* @var \Pterodactyl\Models\User
*/
private $user;
public function __construct(User $user)
public function __construct(private User $user)
{
$this->user = $user;
}
public function via()
public function via(): array
{
return ['mail'];
}
public function toMail()
public function toMail(): MailMessage
{
return (new MailMessage())
->subject('Pterodactyl Test Message')

View file

@ -1,11 +1,4 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Notifications;
@ -18,10 +11,7 @@ class RemovedFromServer extends Notification implements ShouldQueue
{
use Queueable;
/**
* @var object
*/
public $server;
public object $server;
/**
* Create a new notification instance.
@ -33,24 +23,16 @@ class RemovedFromServer extends Notification implements ShouldQueue
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
public function via(): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
public function toMail(): MailMessage
{
return (new MailMessage())
->error()

View file

@ -1,11 +1,4 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Notifications;
@ -18,43 +11,25 @@ class SendPasswordReset extends Notification implements ShouldQueue
{
use Queueable;
/**
* The password reset token.
*
* @var string
*/
public $token;
/**
* Create a new notification instance.
*
* @param string $token
*/
public function __construct($token)
public function __construct(public string $token)
{
$this->token = $token;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
public function via(): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
public function toMail(mixed $notifiable): MailMessage
{
return (new MailMessage())
->subject('Reset Password')

View file

@ -2,9 +2,12 @@
namespace Pterodactyl\Notifications;
use Pterodactyl\Models\User;
use Illuminate\Bus\Queueable;
use Pterodactyl\Events\Event;
use Pterodactyl\Models\Server;
use Illuminate\Container\Container;
use Pterodactyl\Events\Server\Installed;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Pterodactyl\Contracts\Core\ReceivesEvents;
@ -15,23 +18,15 @@ class ServerInstalled extends Notification implements ShouldQueue, ReceivesEvent
{
use Queueable;
/**
* @var \Pterodactyl\Models\Server
*/
public $server;
public Server $server;
/**
* @var \Pterodactyl\Models\User
*/
public $user;
public User $user;
/**
* Handle a direct call to this notification from the server installed event. This is configured
* in the event service provider.
*
* @param \Pterodactyl\Events\Event|\Pterodactyl\Events\Server\Installed $event
*/
public function handle(Event $event): void
public function handle(Event|Installed $event): void
{
$event->server->loadMissing('user');
@ -45,20 +40,16 @@ class ServerInstalled extends Notification implements ShouldQueue, ReceivesEvent
/**
* Get the notification's delivery channels.
*
* @return array
*/
public function via()
public function via(): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail()
public function toMail(): MailMessage
{
return (new MailMessage())
->greeting('Hello ' . $this->user->username . '.')