File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ */
4+ namespace Mhorninger \SQLite ;
5+ /**
6+ * The Laravel ServiceProvider that initializes the MySQLite Connection.
7+ */
8+ class MySQLiteServiceProvider extends \Illuminate \Support \ServiceProvider
9+ {
10+ /**
11+ * Bootstrap the application events.
12+ *
13+ * @return void
14+ */
15+ public function boot ()
16+ {
17+ Model::setConnectionResolver ($ this ->app ['db ' ]);
18+ Model::setEventDispatcher ($ this ->app ['events ' ]);
19+ }
20+ /**
21+ * Register the service provider.
22+ *
23+ * @return Connection connection
24+ */
25+ public function register ()
26+ {
27+ // Add database driver.
28+ $ this ->app ->resolving (
29+ 'db ' ,
30+ function ($ db ) {
31+ $ db ->extend (
32+ 'sqlite ' ,
33+ function ($ config , $ name ) {
34+ $ config ['name ' ] = $ name ;
35+ return new Connection ($ config );
36+ }
37+ );
38+ }
39+ );
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments