Skip to content

Commit c976622

Browse files
authored
Merge pull request #55 from jaulz/patch-4
feat: allow user to turn off migrations
2 parents d775922 + a350fe1 commit c976622

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

config/acquaintances.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<?php
22

33
return [
4+
/**
5+
* Load migrations from package migrations,
6+
* If you published the migration files, please set to `false`.
7+
*/
8+
'migrations' => false,
9+
410
/*
511
* Models Related.
612
*/

src/AcquaintancesServiceProvider.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ public function boot()
2626
*/
2727
protected function registerMigrations()
2828
{
29-
if (count(\File::glob(database_path('migrations/*acquaintances*.php'))) === 0) {
29+
$config = $this->app['config']['acquaintances'];
30+
$runMigrations = is_null($config['migrations'] ?? null)
31+
? count(\File::glob(database_path('migrations/*acquaintances*.php'))) === 0
32+
: $config['migrations'];
33+
34+
if ($runMigrations) {
3035
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
3136
}
3237
}

0 commit comments

Comments
 (0)