testing php storm code cleanup and styling

This commit is contained in:
Andras Bacsai
2023-08-08 11:51:36 +02:00
parent a8ee779b31
commit f2228cec7b
368 changed files with 23834 additions and 2623 deletions

View File

@@ -4,9 +4,8 @@ namespace App\Notifications\Application;
use App\Models\Application;
use App\Models\ApplicationPreview;
use App\Models\Team;
use App\Notifications\Channels\EmailChannel;
use App\Notifications\Channels\DiscordChannel;
use App\Notifications\Channels\EmailChannel;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
@@ -16,6 +15,7 @@ use Illuminate\Support\Str;
class DeploymentFailed extends Notification implements ShouldQueue
{
use Queueable;
public Application $application;
public string $deployment_uuid;
public ApplicationPreview|null $preview;
@@ -38,8 +38,9 @@ class DeploymentFailed extends Notification implements ShouldQueue
if (Str::of($this->fqdn)->explode(',')->count() > 1) {
$this->fqdn = Str::of($this->fqdn)->explode(',')->first();
}
$this->deployment_url = base_url() . "/project/{$this->project_uuid}/{$this->environment_name}/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";
$this->deployment_url = base_url() . "/project/{$this->project_uuid}/{$this->environment_name}/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";
}
public function via(object $notifiable): array
{
$channels = [];
@@ -56,6 +57,7 @@ class DeploymentFailed extends Notification implements ShouldQueue
}
return $channels;
}
public function toMail(): MailMessage
{
$mail = new MailMessage();
@@ -88,4 +90,4 @@ class DeploymentFailed extends Notification implements ShouldQueue
}
return $message;
}
}
}

View File

@@ -4,9 +4,8 @@ namespace App\Notifications\Application;
use App\Models\Application;
use App\Models\ApplicationPreview;
use App\Models\Team;
use App\Notifications\Channels\EmailChannel;
use App\Notifications\Channels\DiscordChannel;
use App\Notifications\Channels\EmailChannel;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
@@ -16,6 +15,7 @@ use Illuminate\Support\Str;
class DeploymentSuccess extends Notification implements ShouldQueue
{
use Queueable;
public Application $application;
public string $deployment_uuid;
public ApplicationPreview|null $preview = null;
@@ -38,8 +38,9 @@ class DeploymentSuccess extends Notification implements ShouldQueue
if (Str::of($this->fqdn)->explode(',')->count() > 1) {
$this->fqdn = Str::of($this->fqdn)->explode(',')->first();
}
$this->deployment_url = base_url() . "/project/{$this->project_uuid}/{$this->environment_name}/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";
$this->deployment_url = base_url() . "/project/{$this->project_uuid}/{$this->environment_name}/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";
}
public function via(object $notifiable): array
{
$channels = [];
@@ -56,6 +57,7 @@ class DeploymentSuccess extends Notification implements ShouldQueue
}
return $channels;
}
public function toMail(): MailMessage
{
$mail = new MailMessage();
@@ -97,4 +99,4 @@ class DeploymentSuccess extends Notification implements ShouldQueue
}
return $message;
}
}
}

View File

@@ -2,10 +2,8 @@
namespace App\Notifications\Application;
use App\Models\Application;
use App\Models\ApplicationPreview;
use App\Notifications\Channels\EmailChannel;
use App\Notifications\Channels\DiscordChannel;
use App\Notifications\Channels\EmailChannel;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
@@ -15,6 +13,7 @@ use Illuminate\Support\Str;
class StatusChanged extends Notification implements ShouldQueue
{
use Queueable;
public $application;
public string $application_name;
@@ -33,8 +32,9 @@ class StatusChanged extends Notification implements ShouldQueue
if (Str::of($this->fqdn)->explode(',')->count() > 1) {
$this->fqdn = Str::of($this->fqdn)->explode(',')->first();
}
$this->application_url = base_url() . "/project/{$this->project_uuid}/{$this->environment_name}/application/{$this->application->uuid}";
$this->application_url = base_url() . "/project/{$this->project_uuid}/{$this->environment_name}/application/{$this->application->uuid}";
}
public function via(object $notifiable): array
{
$channels = [];
@@ -51,6 +51,7 @@ class StatusChanged extends Notification implements ShouldQueue
}
return $channels;
}
public function toMail(): MailMessage
{
$mail = new MailMessage();
@@ -72,4 +73,4 @@ class StatusChanged extends Notification implements ShouldQueue
$message .= '[Application URL](' . $this->application_url . ')';
return $message;
}
}
}

View File

@@ -22,7 +22,7 @@ class EmailChannel
Mail::send(
[],
[],
fn (Message $message) => $message
fn(Message $message) => $message
->from(
data_get($notifiable, 'smtp_from_address'),
data_get($notifiable, 'smtp_from_name'),
@@ -50,4 +50,4 @@ class EmailChannel
"local_domain" => null,
]);
}
}
}

View File

@@ -25,7 +25,7 @@ class TransactionalEmailChannel
Mail::send(
[],
[],
fn (Message $message) => $message
fn(Message $message) => $message
->from(
data_get($settings, 'smtp_from_address'),
data_get($settings, 'smtp_from_name')
@@ -40,4 +40,4 @@ class TransactionalEmailChannel
{
set_transanctional_email_settings();
}
}
}

View File

@@ -2,8 +2,8 @@
namespace App\Notifications;
use App\Notifications\Channels\EmailChannel;
use App\Notifications\Channels\DiscordChannel;
use App\Notifications\Channels\EmailChannel;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
@@ -12,8 +12,10 @@ use Illuminate\Notifications\Notification;
class Test extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(public string|null $emails = null)
{}
{
}
public function via(object $notifiable): array
{
@@ -30,6 +32,7 @@ class Test extends Notification implements ShouldQueue
}
return $channels;
}
public function toMail(): MailMessage
{
$mail = new MailMessage();
@@ -37,6 +40,7 @@ class Test extends Notification implements ShouldQueue
$mail->view('emails.test');
return $mail;
}
public function toDiscord(): string
{
$message = 'This is a test Discord notification from Coolify.';
@@ -44,4 +48,4 @@ class Test extends Notification implements ShouldQueue
$message .= '[Go to your dashboard](' . base_url() . ')';
return $message;
}
}
}

View File

@@ -14,6 +14,7 @@ use Illuminate\Notifications\Notification;
class InvitationLink extends Notification implements ShouldQueue
{
use Queueable;
public function via()
{
return [TransactionalEmailChannel::class];
@@ -33,4 +34,4 @@ class InvitationLink extends Notification implements ShouldQueue
]);
return $mail;
}
}
}

View File

@@ -2,26 +2,36 @@
namespace App\Notifications\TransactionalEmails;
use App\Models\InstanceSettings;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Lang;
use App\Models\InstanceSettings;
class ResetPassword extends Notification
{
public $token;
public InstanceSettings $settings;
public static $createUrlCallback;
public static $toMailCallback;
public $token;
public InstanceSettings $settings;
public function __construct($token)
{
$this->settings = InstanceSettings::get();
$this->token = $token;
}
public static function createUrlUsing($callback)
{
static::$createUrlCallback = $callback;
}
public static function toMailUsing($callback)
{
static::$toMailCallback = $callback;
}
public function via($notifiable)
{
if ($this->settings->smtp_enabled){
if ($this->settings->smtp_enabled) {
$password = data_get($this->settings, 'smtp_password');
if ($password) $password = decrypt($password);
@@ -50,6 +60,7 @@ class ResetPassword extends Notification
return $this->buildMailMessage($this->resetUrl($notifiable));
}
protected function buildMailMessage($url)
{
$mail = new MailMessage();
@@ -58,9 +69,10 @@ class ResetPassword extends Notification
data_get($this->settings, 'smtp_from_name'),
);
$mail->subject('Reset Password');
$mail->view('emails.reset-password', ['url' => $url,'count' => config('auth.passwords.'.config('auth.defaults.passwords').'.expire')]);
$mail->view('emails.reset-password', ['url' => $url, 'count' => config('auth.passwords.' . config('auth.defaults.passwords') . '.expire')]);
return $mail;
}
protected function resetUrl($notifiable)
{
if (static::$createUrlCallback) {
@@ -72,12 +84,4 @@ class ResetPassword extends Notification
'email' => $notifiable->getEmailForPasswordReset(),
], false));
}
public static function createUrlUsing($callback)
{
static::$createUrlCallback = $callback;
}
public static function toMailUsing($callback)
{
static::$toMailCallback = $callback;
}
}
}

View File

@@ -13,7 +13,8 @@ class Test extends Notification implements ShouldQueue
use Queueable;
public function __construct(public string $emails)
{}
{
}
public function via(): array
{
@@ -27,4 +28,4 @@ class Test extends Notification implements ShouldQueue
$mail->view('emails.test');
return $mail;
}
}
}