File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,24 @@ class BatchNotificationsServiceProvider extends ServiceProvider
1313 */
1414 public function boot ()
1515 {
16- if ($ this ->app ->runningInConsole ()) {
17- $ this ->publishes ([
18- __DIR__ .'/../migrations/2018_09_04_205640_create_batch_notification_tables.php ' => base_path ('database/migrations ' ),
19- ]);
16+ $ time = time ();
2017
21- $ this ->commands ([
22- Console \DispatchBatchNotifications::class
23- ]);
18+ if (!class_exists ('CreateBatchNotificationTables ' )) {
19+ $ migrationFileName = $ this ->getMigrationFilename ('create_batch_notification_tables ' , $ time );
20+ $ this ->publishes ([
21+ __DIR__ .'/../migrations/2018_09_04_205640_create_batch_notification_tables.php ' => $ migrationFileName ,
22+ ], 'migrations ' );
2423 }
24+
25+ $ this ->commands ([
26+ Console \DispatchBatchNotifications::class
27+ ]);
28+ }
29+
30+ protected function getMigrationFileName ($ migrationName , $ time )
31+ {
32+ $ timestamp = date ('Y_m_d_His ' , $ time );
33+
34+ return $ this ->app ->databasePath () . "/migrations/ {$ timestamp }_ {$ migrationName }.php " ;
2535 }
2636}
You can’t perform that action at this time.
0 commit comments