2020use Barryvdh \Debugbar \Storage \SocketStorage ;
2121use Barryvdh \Debugbar \Storage \FilesystemStorage ;
2222use Barryvdh \Debugbar \Support \Clockwork \ClockworkCollector ;
23- use Barryvdh \Debugbar \Support \RequestIdGenerator ;
2423use DebugBar \Bridge \MonologCollector ;
24+ use DebugBar \Bridge \SwiftMailer \SwiftLogCollector ;
25+ use DebugBar \Bridge \SwiftMailer \SwiftMailCollector ;
2526use DebugBar \Bridge \Symfony \SymfonyMailCollector ;
2627use DebugBar \DataCollector \ConfigCollector ;
2728use DebugBar \DataCollector \DataCollectorInterface ;
@@ -119,7 +120,6 @@ public function __construct($app = null)
119120 if ($ this ->is_lumen ) {
120121 $ this ->version = Str::betweenFirst ($ app ->version (), '( ' , ') ' );
121122 }
122- $ this ->setRequestIdGenerator (new RequestIdGenerator ());
123123 }
124124
125125 /**
@@ -473,17 +473,27 @@ function (\Illuminate\Database\Events\ConnectionEstablished $event) {
473473
474474 if ($ this ->shouldCollect ('mail ' , true ) && class_exists ('Illuminate\Mail\MailServiceProvider ' ) && $ events ) {
475475 try {
476- $ mailCollector = new SymfonyMailCollector ();
476+ if ($ this ->checkVersion ('9.0 ' )) {
477+ $ mailCollector = new SymfonyMailCollector ();
478+ $ events ->listen (function (MessageSent $ event ) use ($ mailCollector ) {
479+ $ mailCollector ->addSymfonyMessage ($ event ->sent ->getSymfonySentMessage ());
480+ });
481+ } else {
482+ $ mailer = $ app ['mailer ' ]->getSwiftMailer ();
483+ $ mailCollector = new SwiftMailCollector ($ mailer );
484+
485+ if ($ config ->get ('debugbar.options.mail.show_body ' ) && $ this ->hasCollector ('messages ' )) {
486+ $ this ['messages ' ]->aggregate (new SwiftLogCollector ($ mailer ));
487+ }
488+ }
489+
477490 $ this ->addCollector ($ mailCollector );
478- $ events ->listen (function (MessageSent $ event ) use ($ mailCollector ) {
479- $ mailCollector ->addSymfonyMessage ($ event ->sent ->getSymfonySentMessage ());
480- });
481491
482492 if ($ config ->get ('debugbar.options.mail.show_body ' ) || $ config ->get ('debugbar.options.mail.full_log ' )) {
483493 $ mailCollector ->showMessageBody ();
484494 }
485495
486- if ($ this ->hasCollector ('time ' ) && $ config ->get ('debugbar.options.mail.timeline ' )) {
496+ if ($ this ->hasCollector ('time ' ) && $ config ->get ('debugbar.options.mail.timeline ' ) && $ this -> checkVersion ( ' 9.0 ' ) ) {
487497 $ transport = $ app ['mailer ' ]->getSymfonyTransport ();
488498 $ app ['mailer ' ]->setSymfonyTransport (new class ($ transport , $ this ) extends AbstractTransport{
489499 private $ originalTransport ;
@@ -514,7 +524,9 @@ public function __toString(): string
514524 });
515525 }
516526 } catch (Exception $ e ) {
517- $ this ->addCollectorException ('Cannot add SymfonyMailCollector ' , $ e );
527+ $ this ->addCollectorException (
528+ 'Cannot add ' .($ this ->checkVersion ('9.0 ' )?'SymfonyMailCollector ' :'SwiftMailCollector ' ), $ e
529+ );
518530 }
519531 }
520532
@@ -526,9 +538,6 @@ public function __toString(): string
526538 $ this ->addCollectorException ('Cannot add LogsCollector ' , $ e );
527539 }
528540 }
529- if ($ this ->shouldCollect ('files ' , false )) {
530- $ this ->addCollector (new FilesCollector ($ app ));
531- }
532541
533542 if ($ this ->shouldCollect ('auth ' , false )) {
534543 try {
0 commit comments