MessageController.php 543 B

12345678910111213141516171819202122
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\NotificationLog;
  4. use Illuminate\Mail\Markdown;
  5. class MessageController extends Controller
  6. {
  7. public function index(string $type, string $msgId)
  8. {
  9. if ($type === 'markdown') {
  10. $log = NotificationLog::whereMsgId($msgId)->latest()->firstOrFail();
  11. $title = $log->title;
  12. $content = Markdown::parse($log->content)->toHtml();
  13. return view('components.message', compact('title', 'content'));
  14. }
  15. return false;
  16. }
  17. }