complete story 8.10 with qa test
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Throwable;
|
||||
|
||||
class SystemErrorNotification extends Notification
|
||||
{
|
||||
public function __construct(
|
||||
public Throwable $exception
|
||||
) {}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
$environment = app()->environment();
|
||||
$errorType = class_basename($this->exception);
|
||||
|
||||
return (new MailMessage)
|
||||
->subject("[URGENT] [{$environment}] System Error: {$errorType} - Libra Law Firm")
|
||||
->greeting('System Alert')
|
||||
->line('A critical error occurred on the platform.')
|
||||
->line("**Error Type:** {$errorType}")
|
||||
->line('**Message:** '.$this->exception->getMessage())
|
||||
->line('**File:** '.$this->exception->getFile().':'.$this->exception->getLine())
|
||||
->line('**Time:** '.now()->format('Y-m-d H:i:s'))
|
||||
->line("**Environment:** {$environment}")
|
||||
->line('Please check the application logs for full stack trace and details.')
|
||||
->salutation('— Libra System Monitor');
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'type' => 'system_error',
|
||||
'error_type' => class_basename($this->exception),
|
||||
'message' => $this->exception->getMessage(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user