Skip to content

Commit

Permalink
Merge pull request #1 from nikolaynesov/master
Browse files Browse the repository at this point in the history
Publish migrations
  • Loading branch information
httpoz authored Sep 7, 2016
2 parents c9094b1 + e3a6ef0 commit 7640839
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Add the package to your application service providers in `config/app.php` file.

Publish the package config file and migrations to your application. Run these commands inside your terminal.

php artisan vendor:publish --provider="HttpOz\Roles\RolesServiceProvider" --tag=config
php artisan vendor:publish --provider="HttpOz\Roles\RolesServiceProvider"

And also run migrations.

Expand Down Expand Up @@ -272,4 +272,4 @@ For more information, please have a look at [HasRole](https://github.com/httpoz/

## License

This package is free software distributed under the terms of the MIT license.
This package is free software distributed under the terms of the MIT license.
12 changes: 9 additions & 3 deletions src/HttpOz/Roles/RolesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ public function boot()
$this->publishes([
__DIR__ . '/../../config/roles.php' => config_path('roles.php')
], 'config');

$this->loadMigrationsFrom(__DIR__ . '/../../migrations/');

$stub = __DIR__ . '/../../migrations/';
$target = database_path('migrations').'/';

$this->publishes([
$stub.'create_roles_table.php' => $target.date('Y_m_d_His', time()).'_create_roles_table.php',
$stub.'create_role_user_table.php' => $target.date('Y_m_d_His', time()+1).'_create_role_user_table.php'
], 'migrations');

$this->registerBladeExtensions();
}
Expand Down Expand Up @@ -54,4 +60,4 @@ public function registerBladeExtensions()
return "<?php endif; ?>";
});
}
}
}
File renamed without changes.
File renamed without changes.

0 comments on commit 7640839

Please sign in to comment.