Alert System
Email Templates
You can customize the email templates used for alerts. First, publish the views:
1php artisan vendor:publish --tag=alert-system-views
The default template is located at:
resources/views/vendor/alert-system/mail/error_alerts/default.blade.php
You can use blade logic to customize the template based on the alert type.
For example, if you have an alert type named System, the package will look for a view at:
resources/views/vendor/alert-system/mail/error_alerts/system.blade.php
If the specific type view doesn't exist, it falls back to the default template.
Example Template
Here is a simple example of what system.blade.php might look like.
You have access to $type, $alertMessage, and $details variables.
1<!DOCTYPE html> 2<html> 3<head> 4 <meta charset="UTF-8"> 5 <title>{{ $type }} Alert</title> 6</head> 7<body style="font-family: sans-serif;"> 8 <div style="padding: 20px; border: 1px solid #ccc; border-radius: 8px;"> 9 <h1 style="color: #ef4444;">🚨 {{ $type }} Alert</h1>10 11 <p style="font-size: 16px;">12 {!! nl2br(e($alertMessage)) !!}13 </p>14 15 @if (!empty($details))16 <div style="background-color: #f3f4f6; padding: 15px; margin-top: 15px; border-radius: 6px;">17 <h3 style="margin-top: 0;">Details:</h3>18 <ul>19 @foreach ($details as $key => $value)20 <li>21 <strong>{{ $key }}:</strong> {{ $value }}22 </li>23 @endforeach24 </ul>25 </div>26 @endif27 28 <footer style="margin-top: 20px; font-size: 12px; color: #666;">29 Sent from {{ config('app.name') }}30 </footer>31 </div>32</body>33</html>