Skip to content

Commit fbc62b1

Browse files
committed
Update
1 parent ebf9317 commit fbc62b1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/EloquentExtension.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Gingdev\NetteExtension;
66

77
use Illuminate\Database\Capsule\Manager;
8+
use Illuminate\Events\Dispatcher;
89
use Nette\DI\CompilerExtension;
910
use Nette\Schema\Expect;
1011
use Nette\Schema\Schema;
@@ -30,7 +31,7 @@ public function loadConfiguration()
3031

3132
$manager = $container->addDefinition($this->prefix('manager'))
3233
->setFactory(Manager::class)
33-
->addSetup('setAsGlobal')
34+
->addSetup('setEventDispatcher', [new Dispatcher()])
3435
->addSetup('bootEloquent')
3536
->setAutowired(true);
3637

@@ -56,5 +57,7 @@ public function loadConfiguration()
5657

5758
$connection->addSetup([$panel, 'register'], [$connection, $name]);
5859
}
60+
61+
$this->initialization->addBody('$this->getService(?)->setAsGlobal();', [$this->prefix('manager')]);
5962
}
6063
}

src/EloquentPanel.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Gingdev\NetteExtension;
66

77
use Illuminate\Database\Connection;
8-
use Illuminate\Events\Dispatcher;
98
use Nette\Utils\Helpers;
109
use Tracy\Debugger;
1110
use Tracy\IBarPanel;
@@ -21,7 +20,6 @@ class EloquentPanel implements IBarPanel
2120
public function register(Connection $connection, string $name)
2221
{
2322
Debugger::getBar()->addPanel($this);
24-
$connection->setEventDispatcher(new Dispatcher());
2523
$connection->listen(function ($query) {
2624
$this->queries[] = $query;
2725
$this->totalTime += $query->time;

0 commit comments

Comments
 (0)