Skip to content

Commit f850d99

Browse files
committed
add connection established event
1 parent cf825bb commit f850d99

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Diff for: src/Illuminate/Database/DatabaseManager.php

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Doctrine\DBAL\Types\Type;
66
use Illuminate\Database\Connectors\ConnectionFactory;
7+
use Illuminate\Database\Events\ConnectionEstablished;
78
use Illuminate\Support\Arr;
89
use Illuminate\Support\ConfigurationUrlParser;
910
use Illuminate\Support\Str;
@@ -99,6 +100,12 @@ public function connection($name = null)
99100
$this->connections[$name] = $this->configure(
100101
$this->makeConnection($database), $type
101102
);
103+
104+
if ($this->app->bound('events')) {
105+
$this->app['events']->dispatch(
106+
new ConnectionEstablished($this->connections[$name])
107+
);
108+
}
102109
}
103110

104111
return $this->connections[$name];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Illuminate\Database\Events;
4+
5+
class ConnectionEstablished extends ConnectionEvent
6+
{
7+
//
8+
}

0 commit comments

Comments
 (0)