Skip to content

Commit

Permalink
Merge pull request #81 from ekawas/migrations-toggle
Browse files Browse the repository at this point in the history
migrations-toggle: re: issue 76 & 40
  • Loading branch information
jeremykenedy authored Sep 26, 2019
2 parents 4f047b5 + 64f8b71 commit b1db83f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ ROLES_PERMISSION_USER_DATABASE_TABLE=permission_user
# Roles Misc Settings
ROLES_DEFAULT_SEPARATOR='.'

# Roles Database Migrations Settings
ROLES_MIGRATION_DEFAULT_ENABLED=true

# Roles Database Seeder Settings
ROLES_SEED_DEFAULT_PERMISSIONS=true
ROLES_SEED_DEFAULT_ROLES=true
Expand Down
9 changes: 8 additions & 1 deletion src/RolesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,21 @@ public function boot()
public function register()
{
$this->mergeConfigFrom(__DIR__.'/config/roles.php', 'roles');
$this->loadMigrationsFrom(__DIR__.'/Database/Migrations');
$this->loadMigrations();
if (config('roles.rolesGuiEnabled')) {
$this->loadViewsFrom(__DIR__.'/resources/views/', $this->_packageTag);
}
$this->publishFiles();
$this->loadSeedsFrom();
}

private function loadMigrations()
{
if (config('roles.defaultMigrations.enabled')) {
$this->loadMigrationsFrom(__DIR__.'/Database/Migrations');
}
}

/**
* Loads a seeds.
*
Expand Down
13 changes: 13 additions & 0 deletions src/config/roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,20 @@
'allowed' => true,
],
],
/*
|--------------------------------------------------------------------------
| Default Migrations
|--------------------------------------------------------------------------
|
| These are the default package migrations. If you publish the migrations
| to your project, then this is not necessary and should be disabled. This
| will enable our default migrations.
|
*/

'defaultMigrations' => [
'enabled' => env('ROLES_MIGRATION_DEFAULT_ENABLED', false),
],
/*
|--------------------------------------------------------------------------
| Default Seeds
Expand Down

0 comments on commit b1db83f

Please sign in to comment.