Skip to content

Commit 6602b11

Browse files
committed
Add back mail provider
1 parent 4f9e8b7 commit 6602b11

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/LumenDebugbar.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,9 @@ function () use ($debugbar, $startTime) {
8989
}
9090
);
9191

92-
9392
$debugbar->startMeasure('application', 'Application');
94-
95-
9693
}
94+
9795
if ($this->shouldCollect('memory', true)) {
9896
$this->addCollector(new MemoryCollector());
9997
}
@@ -151,7 +149,6 @@ function ($view) use ($debugbar) {
151149
}
152150
}
153151

154-
155152
if ($this->shouldCollect('db', true) && isset($this->app['db'])) {
156153
$db = $this->app['db'];
157154
if ($debugbar->hasCollector('time') && $this->app['config']->get(
@@ -202,6 +199,24 @@ function ($query, $bindings, $time, $connectionName) use ($db, $queryCollector)
202199
}
203200
}
204201

202+
if ($this->shouldCollect('mail', true) && class_exists('Illuminate\Mail\MailServiceProvider')) {
203+
try {
204+
$mailer = $this->app['mailer']->getSwiftMailer();
205+
$this->addCollector(new SwiftMailCollector($mailer));
206+
if ($this->app['config']->get('debugbar.options.mail.full_log') && $this->hasCollector(
207+
'messages'
208+
)
209+
) {
210+
$this['messages']->aggregate(new SwiftLogCollector($mailer));
211+
}
212+
} catch (\Exception $e) {
213+
$this->addException(
214+
new Exception(
215+
'Cannot add MailCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e
216+
)
217+
);
218+
}
219+
}
205220

206221
if ($this->shouldCollect('logs', false)) {
207222
try {

0 commit comments

Comments
 (0)