@@ -63,13 +63,27 @@ public function boot()
63
63
{
64
64
if ($ this ->app ->runningInConsole ()) {
65
65
$ this ->registerConfig ();
66
+ $ this ->registerFolder ();
66
67
}
67
68
}
68
69
70
+ /**
71
+ * Registers the config file for the package.
72
+ */
69
73
protected function registerConfig ()
70
74
{
71
75
$ this ->publishes ([
72
- __DIR__ . '/../config/data-migrations.php ' => config_path ('data-migrations.php ' ),
76
+ __DIR__ . '/../assets/config/data-migrations.php ' => config_path ('data-migrations.php ' ),
77
+ ], 'data-migrations ' );
78
+ }
79
+
80
+ /**
81
+ * Registers the default folder of where the data migrations will be created.
82
+ */
83
+ protected function registerFolder ()
84
+ {
85
+ $ this ->publishes ([
86
+ __DIR__ . '/../assets/database/migrations_data ' => database_path ('data_migrations ' ),
73
87
], 'data-migrations ' );
74
88
}
75
89
@@ -80,14 +94,17 @@ protected function registerConfig()
80
94
*/
81
95
public function register ()
82
96
{
83
- $ this ->registerRepository ();
84
- $ this ->registerMigrator ();
85
- $ this ->registerArtisanCommands ();
97
+ $ this ->bindRepository ();
98
+ $ this ->bindMigrator ();
99
+ $ this ->bindArtisanCommands ();
86
100
87
101
$ this ->commands ($ this ->commands );
88
102
}
89
103
90
- protected function registerRepository ()
104
+ /**
105
+ * Binds the repository used by the data migrations.
106
+ */
107
+ protected function bindRepository ()
91
108
{
92
109
$ this ->app ->singleton ('migration.data.repository ' , function ($ app ) {
93
110
$ table = config ('data-migrations.table ' );
@@ -96,7 +113,10 @@ protected function registerRepository()
96
113
});
97
114
}
98
115
99
- protected function registerMigrator ()
116
+ /**
117
+ * Binds the migrator used by the data migrations.
118
+ */
119
+ protected function bindMigrator ()
100
120
{
101
121
$ this ->app ->singleton ('migrator.data ' , function ($ app ) {
102
122
$ repository = $ app ['migration.data.repository ' ];
@@ -105,7 +125,10 @@ protected function registerMigrator()
105
125
});
106
126
}
107
127
108
- protected function registerArtisanCommands ()
128
+ /**
129
+ * Binds the commands to execute the data migrations.
130
+ */
131
+ protected function bindArtisanCommands ()
109
132
{
110
133
$ this ->app ->singleton ('command.migrate-data ' , function ($ app ) {
111
134
return new MigrateDataCommand ($ app ['migrator.data ' ]);
0 commit comments