Initialer Laravel Commit für BetiX
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

This commit is contained in:
2026-04-04 18:01:50 +02:00
commit 0280278978
374 changed files with 65210 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class FriendRequestNotification extends Notification
{
use Queueable;
public int $senderId;
public string $senderUsername;
public ?string $senderAvatar;
public int $friendRequestId;
public function __construct(int $senderId, string $senderUsername, ?string $senderAvatar, int $friendRequestId)
{
$this->senderId = $senderId;
$this->senderUsername = $senderUsername;
$this->senderAvatar = $senderAvatar;
$this->friendRequestId = $friendRequestId;
}
public function via(object $notifiable): array
{
return ['database'];
}
public function toArray(object $notifiable): array
{
return [
'kind' => 'friend_request',
'icon' => 'user-plus',
'title' => 'Friend request',
'desc' => $this->senderUsername.' sent you a friend request',
'sender' => [
'id' => $this->senderId,
'username' => $this->senderUsername,
'avatar' => $this->senderAvatar,
],
'friend_request_id' => $this->friendRequestId,
];
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class NewLoginDetected extends Notification implements ShouldQueue
{
use Queueable;
public string $ip;
public string $userAgent;
public string $loginAt;
public function __construct(string $ip, string $userAgent, string $loginAt)
{
$this->ip = $ip;
$this->userAgent = $userAgent;
$this->loginAt = $loginAt;
}
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject('New Login Detected on Your Account')
->view('emails.new-login', [
'user' => $notifiable,
'ip' => $this->ip,
'userAgent' => $this->userAgent,
'loginAt' => $this->loginAt,
'appName' => config('app.name'),
'supportEmail' => config('mail.from.address'),
'manageLink' => url('/settings/security'),
]);
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Notifications;
use Illuminate\Auth\Notifications\ResetPassword as BaseResetPassword;
use Illuminate\Notifications\Messages\MailMessage;
class ResetPassword extends BaseResetPassword
{
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$url = url(route('password.reset', [
'token' => $this->token,
'email' => $notifiable->getEmailForPasswordReset(),
], false));
return (new MailMessage)
->subject('Reset Password Notification')
->view('emails.reset-password', ['url' => $url, 'user' => $notifiable]);
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Notifications;
use Illuminate\Auth\Notifications\VerifyEmail as BaseVerifyEmail;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Cache;
class VerifyEmail extends BaseVerifyEmail
{
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$verificationUrl = $this->verificationUrl($notifiable);
// Generate a 6-digit fallback verification code with same TTL as the link
$ttl = (int) Config::get('auth.verification.expire', 60);
$code = (string) random_int(100000, 999999);
Cache::put('email_verify_code:'.$notifiable->getKey(), $code, now()->addMinutes($ttl));
return (new MailMessage)
->subject('Verify Your Email Address')
->view('emails.verify-email', [
'url' => $verificationUrl,
'user' => $notifiable,
'code' => $code,
]);
}
}