FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
database/MigrationServiceProvider.php at master · fwling/database · GitHub
fwling
database
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
database
/
MigrationServiceProvider.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
87 lines (75 loc) · 2.08 KB
Breadcrumbs
database
/
MigrationServiceProvider.php
Copy path
File metadata and controls
executable file
·
87 lines (75 loc) · 2.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
namespace
Illuminate
\
Database
;
use
Illuminate
\
Support
\
ServiceProvider
;
use
Illuminate
\
Database
\
Migrations
\
Migrator
;
use
Illuminate
\
Database
\
Migrations
\
MigrationCreator
;
use
Illuminate
\
Database
\
Migrations
\
DatabaseMigrationRepository
;
class
MigrationServiceProvider
extends
ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected
$
defer
=
true
;
/**
* Register the service provider.
*
* @return void
*/
public
function
register
()
{
$
this
->
registerRepository
();
$
this
->
registerMigrator
();
$
this
->
registerCreator
();
}
/**
* Register the migration repository service.
*
* @return void
*/
protected
function
registerRepository
()
{
$
this
->
app
->
singleton
(
'
migration.repository
'
,
function
(
$
app
) {
$
table
=
$
app
[
'
config
'
][
'
database.migrations
'
];
return
new
DatabaseMigrationRepository
(
$
app
[
'
db
'
],
$
table
);
});
}
/**
* Register the migrator service.
*
* @return void
*/
protected
function
registerMigrator
()
{
// The migrator is responsible for actually running and rollback the migration
// files in the application. We'll pass in our database connection resolver
// so the migrator can resolve any of these connections when it needs to.
$
this
->
app
->
singleton
(
'
migrator
'
,
function
(
$
app
) {
$
repository
=
$
app
[
'
migration.repository
'
];
return
new
Migrator
(
$
repository
,
$
app
[
'
db
'
],
$
app
[
'
files
'
]);
});
}
/**
* Register the migration creator.
*
* @return void
*/
protected
function
registerCreator
()
{
$
this
->
app
->
singleton
(
'
migration.creator
'
,
function
(
$
app
) {
return
new
MigrationCreator
(
$
app
[
'
files
'
]);
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public
function
provides
()
{
return
[
'
migrator
'
,
'
migration.repository
'
,
'
migration.creator
'
,
];
}
}
Back
|
FazBrowse Home
|
New Git URL